Just switched to using gcc on my windows 98 pc. Programs were compiling fine
on a propriety compiler. Now, though, it gives me an error message for a for
loop, "line xx: use of header-defined for loop outside of c99 mode". What is
this? 7 9045
"MikeyD" <m_*********@hotmail.com> wrote in
news:10***************@doris.uk.clara.net: Just switched to using gcc on my windows 98 pc. Programs were compiling fine on a propriety compiler. Now, though, it gives me an error message for a for loop, "line xx: use of header-defined for loop outside of c99 mode". What is this?
Not sure, I can't read your mind. Show us a very small example of the
problem code.
--
- Mark ->
--
On Fri, 19 Sep 2003 20:14:49 +0100
"MikeyD" <m_*********@hotmail.com> wrote: Just switched to using gcc on my windows 98 pc. Programs were compiling fine on a propriety compiler. Now, though, it gives me an error message for a for loop, "line xx: use of header-defined for loop outside of c99 mode". What is this?
Post the smallest compilable snippet triggering this error.
--
char*x(c,k,s)char*k,*s;{if(!k)return*s-36?x(0,0,s+1):s;if(s)if(*s)c=10+(c?(x(
c,k,0),x(c,k+=*s-c,s+1),*k):(x(*s,k,s+1),0));else c=10;printf(&x(~0,0,k)[c-~-
c+"1"[~c<-c]],c);}main(){x(0,"^[kXc6]dn_eaoh$%c","-34*1'.+(,03#;+,)/'///*");}
On Fri, 19 Sep 2003 20:14:49 +0100, MikeyD wrote: Just switched to using gcc on my windows 98 pc. Programs were compiling fine on a propriety compiler. Now, though, it gives me an error message for a for loop, "line xx: use of header-defined for loop outside of c99 mode". What is this?
I don't know exactly what the message means, but there must be some way to
invoke gcc so that it is more permissive. Maybe check out the
documentation for gcc. Do a "man gcc" or a "gcc --help".
From the context, I am pretty sure that "c99 mode" means a mode where gcc
allows some of the features from the c standard as ratified in 1999 (as
opposed to the previous standard which is usually called c89).
So, since it sounds like it has something to do with c99, try searching
through the documentation for "c99." I'm sure you'll find a solution. ;-)
Mac
--
"MikeyD" <m_*********@hotmail.com> wrote: Just switched to using gcc on my windows 98 pc. Programs were compiling fine on a propriety compiler. Now, though, it gives me an error message for a for loop, "line xx: use of header-defined for loop outside of c99 mode". What is this?
I don't know that error message specifically. However it's probably similar to:
int main(void)
{
for(int i = 0; i < 10; i++);
return 0;
}
C:\prog\c>gcc mikeyd.c
mikeyd.c: In function `main':
mikeyd.c:3: `for' loop initial declaration used outside C99 mode
You can fix this by just adding -std=c99 to the command line.
Or, if you want the code to function properly on older compilers, you
will need to move all the declarations out of the for loops whenever
this occurs.
--
Simon.
"Pieter Droogendijk" <gi*@binky.homeunix.org> wrote in message
news:20030919213113.15332b79.gi*@binky.homeunix.or g... On Fri, 19 Sep 2003 20:14:49 +0100 "MikeyD" <m_*********@hotmail.com> wrote: Just switched to using gcc on my windows 98 pc. Programs were compiling
fine on a propriety compiler. Now, though, it gives me an error message for a
for loop, "line xx: use of header-defined for loop outside of c99 mode".
What is this?
Post the smallest compilable snippet triggering this error.
#include <stdio.h>
int main(void){
for(int i=1;i<10;i++)
printf("%d",i);
return 0;
}
I may have mixed up error messages, since I'm now getting "test.c:3: error:
'for' loop initial declaration used outside c99 mode"
On Sat, 20 Sep 2003 17:55:44 +1000, Simon Biber wrote: I don't know that error message specifically. However it's probably similar to:
int main(void) { for(int i = 0; i < 10; i++); return 0; }
C:\prog\c>gcc mikeyd.c mikeyd.c: In function `main': mikeyd.c:3: `for' loop initial declaration used outside C99 mode
You can fix this by just adding -std=c99 to the command line.
And making sure you don't also use -ansi, as this seems to override
-std=c99.
Mac
--
MikeyD wrote: #include <stdio.h> int main(void){ for(int i=1;i<10;i++) printf("%d",i); return 0; } I may have mixed up error messages, since I'm now getting "test.c:3: error: 'for' loop initial declaration used outside c99 mode"
The problem is that in C you can't declare a variable at the initialization part
of the for-loop as you can in C++ for example. That's changed though in C99,
that's why the compiler tells you that either your code is wrong, or you forgot
to tell it you are writing C99.
-- Nuclear / the Lab -- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stephen Miller |
last post by:
Firstly, sorry for the long post, but I've included a fair bit of
sample data.
Im doing a comparision of 10yr Bond prices and CPI adjustments, with
an 18 week moving average of the CPI. I'm...
|
by: Hemant Shah |
last post by:
Folks,
I need to move HOME directory of an instance to another directory.
What is the best way of doing it?
Is changing password file enough? or dies DB2 store this info in it's own
config?
...
|
by: James |
last post by:
Hello group:
I don't know if this is by design, or something I can change: I
recently migrated one of our Access tables to SQL server. Now, when
the form bound to the query for that table is...
|
by: ralphsieminsky |
last post by:
A project compiles fine under VS 2005 RC without the /clr
option. However, when /clr is turned on several errors appear:
- A symbol exported from a DLL is not found by another
DLL referencing...
|
by: Ed Jay |
last post by:
I'm using history.go(-n) to return to a page for editing without
refreshing or reinitializing the page. I want to modify the page within
the script, but until I return to the page, the element I...
|
by: Geoff |
last post by:
All my pages come up with "SQL Server does not exist or access denied" after
moving to a new Sql Server with a different name. None of my pages come up
even though I am addressing the servername by...
|
by: CMM |
last post by:
Is it me or has anyone noticed that F1 is really dumb in VS2005. Since VB3 I
have been able to click F1 on an ambiguous method in code and the IDE
automatically determines the type based on the...
|
by: James |
last post by:
I am new to vb.net (I am an old vb6 programmer). I cannot figure out
an easy way to watch variables. In vb6 all I did was right click and
could chose to stop execution when a variable chances as...
|
by: dfelikson |
last post by:
I have a simple piece of code that ftell's me the position after
reading the first line of a file, then reads two more lines, then
fseek's back to the position, and reads the next line. What I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |