How to get into C99 mode in Codeblocks10.05?

落爺英雄遲暮 提交于 2019-12-09 12:11:41

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/12152067/how-to-get-into-c99-mode-in-codeblocks10-05

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!