By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,949 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,949 IT Pros & Developers. It's quick & easy.

C99 Question

P: n/a
This question referes to mingw compiler, a port of gcc for win32.

When I tryed yesterday to compile this code:

int test(void);

int main()
return 0;

int test()
for( int i = 0 ; i < 5 ; i++ );
return 0;

i got the following error: "something about C99 standard"
then I changet the code like that:
int i = 0;
for( i, ..)

and the error was gone.

It was strange. When I tryed to reproduce it with the latest compiler
from mingw I couldn't do it, so I'm asking if that was a bug or just a

In my large projects this is not happening. Maybe I should post it to
mingw newsgroup but it referes the C99 standard.

If anyone has encountered this kind of 'strange error' please let me

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a

I assume the error you got was:
"error: `for' loop initial declaration used outside C99 mode"

You do not seem to have enabled the C99 mode here. Hence the error.

Enable the C99 mode, by using the compiler option "-std=c99".

Hope that helps.


Nov 18 '05 #2

P: n/a

Sriram Rajagopalan wrote:
Enable the C99 mode, by using the compiler option "-std=c99".

Hope that helps.


Yes. That was the problem, and in my projects it didn't happened
because they had that compiler command. This can be reproduced only
outside the projects.
In individual files without that command, I discovered after some
Thanks for the answer.

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.