How do you configure GCC in Eclipse to use C99?

34,280

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.

Share:
34,280
Dai
Author by

Dai

I'm Dai, I'm currently a software engineer in Seattle doing the rounds on a variety of startups. I'm mostly familiar with the .NET stack. (Just don't call me a "full-stack" engineer - there's more to software than a "back-end" vs. "front-end" dichotomy: think about embedded and robotics, industrial control, avionics, systems programming with Rust, and so on!) Prior to the startup scene I was gainfully employed at Microsoft as a Software Engineer for the Chakra JavaScript engine (Edge and Internet Explorer), prior to that I worked on Expression Blend and Visual Studio. I like to think I have extensive experience in C# and the .NET Framework, and modest experience in C++. Prior to Microsoft I worked on web-applications and web-services using ASP.NET Web Forms, ASP.NET MVC, and WCF. I also have experience in PHP, Java and other non-Microsoft platforms and technologies for which I'm happy to answer questions about. Also: Everything is terrible. Life is short and love is always over in the morning.

Updated on February 15, 2020

Comments

  • Dai
    Dai over 4 years

    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?