How do you configure GCC in Eclipse to use C99?

混江龙づ霸主 提交于 2019-12-04 15:04:25

问题


I'm working on a small C project in Eclipse; I just installed Eclipse from the Ubuntu Software Center and added C/C++ Language Support. I can build, run, and debug simple C programs fine.

But I'm using some C99 features now, and Eclipse complains, saying "'for' loop initial declarations are only allowed in C99 mode".

I thought you'd set C99 mode for GCC in the makefile, but the makefile is auto-generated by Eclipse so any changes I make would be overwritten, but I don't see anywhere to put GCC compiler options anywhere in Eclipse's preferences nor my Project Properties windows.

So where do I define C99 mode?


回答1:


Go into project properties. Search for C/C++Build -> Settings. In the Tool Settings tab search for GCC C compiler and then Miscellaneous. In other flags text box add the -std=c99. It should work fine.



来源:https://stackoverflow.com/questions/4236323/how-do-you-configure-gcc-in-eclipse-to-use-c99

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