How to get into C99 mode in Codeblocks10.05?
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!
pying saucepan
* . ) * `. . '. * .' .' * . * * p====y o / Oo \ / /'( )'v /\ * /\ /|~~^^~~|\ /\ / `| /\ * /\/'\\ // \//. \______\/_ /\'\ ____\/____,__/_` ~\\ ____//_^///___/ . _/~ \ | . . \\\______\'/______/ . ___,~-.__\/___/ ____\\/\____ ___.-=*|;^~-.___\'/___,-^._______.~._________/____________\/______________
Updated on June 04, 2022Comments
-
pying saucepan about 2 years
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.