开发者

How do you configure GCC in Eclipse to use C99?

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 s开发者_如何学运维imple 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜