Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get into C99 mode in Codeblocks10.05?

Tags:

c

c99

codeblocks

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.

like image 500
pying saucepan Avatar asked Aug 28 '12 02:08

pying saucepan


People also ask

How do you put C99 in code blocks?

Type "-std=c99" in text area and thats all. cheers!!.

What is C99 or C11 mode?

C11 (formerly C1X) is an informal name for ISO/IEC 9899:2011, a past standard for the C programming language. It replaced C99 (standard ISO/IEC 9899:1999) and has been superseded by C17 (standard ISO/IEC 9899:2018).

What is STD C99?

C99 (previously known as C9X) is an informal name for ISO/IEC 9899:1999, a past version of the C programming language standard.


1 Answers

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!

like image 163
pying saucepan Avatar answered Nov 11 '22 22:11

pying saucepan