How to get into C99 mode in Codeblocks10.05

cc99codeblocks

I recently realized that I am not even in C99 mode after receiving the compile error

'for' loop initial declarations are only allowed in C99 mode

I found some advice on how to get to C99 via a quick search which has told me to go to Projects -> Properties... But alas, it is greyed out and I am not sure that is even the correct way to fix it (probably not available because my file is not a project, it is a normal source file). I have also seen a lot of similar questions saying to enable C99 mode so I have looked inside the compiler flags menu, but I cannot see anything about C99. I have tried some other flags such as In C Mode, support all ISO C90 programs…, but after I set this flag, I got more errors than I had before which seem to appear whenever the compiler finds comments inside main().

Note: Please don't just say to initialize the counter outside the for loop.

Update: While trying to compile outside of codeblocks with gcc, I tried
gcc -O2 -std=C99 filename.c, but received an error:

unrecognized command line option "-std=C99"

I use 64-bit Windows 7, CodeBlocks10.05, and GNU gcc.

Best Answer

For future reference, type in the flag -std=c99 in settings->compiler->other options which is not case-sensitive, however when compiling in a terminal the flag is case-sensitive. Thanks chris!

Related Topic