Setting up Eclipse to compile and resolve C++11 syntax

To get your compiler to use the C++11 flag -std=c++11 and to get the Eclipse editor to recognize the C++11 syntax we need to change two settings in Eclipse.

To get Eclipse to recognize C++11 syntax in the editor for all future projects you do:

Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery

Here you select the CDT GCC Built-in Compiler Settings. You need to add to the text box -std=c++11. Hit OK.

If you already have a project that uses C++11 you need to select:

Project -> C/C++ Index -> Re-resolve Unresolved Includes

which should then recognize the C++11 syntax.

To get your compiler to compile C++11 features you should edit:

Project -> Properties -> C/C++ Build

Here I select [ All configurations ] in the Configuration drop down box so that the -std=c++11 flag is added to all build configurations. Select:

Settings -> GCC C++ Compiler -> Miscellaneous

Here I append “-std=c++11” (without the quotes) to the “Other flags” text box. Now the compiler uses the c++11 compiler option. Hit OK.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s