Setup Eclipse for C++ 11 – Ubuntu 12.04

Setup Eclipse for C++ 11 – Ubuntu 12.04

If you’ve tried compiling something like std::to_string(42) and received a compiler error then chances are your Eclipse CDT isn’t set up for C++ 11.  No worries.  Everything you need is already installed, all you need to do is enter the proper project settings.

To start you need to add the “-std=c++0x” flag to your make file.  To do this in Eclipse, right-click on your project and select Properties.  Next go to C/C++ Build -> Settings and under the Tool Settings tab select Miscellaneous. In the Other flags textbox enter the parameter as shown below.

cpp 11 eclipse setting

Almost done.  Now from the same properties window go to the C/C++ General section and select Paths and Symbols.  Select the Symbols tab and under Languages pick GNU C++.  Click the Add button.

C++ 11 Symbols

In the Add Symbol window enter __GXX_EXPERIMENTAL_CXX0X__ as the Name of the symbol.  Keep the the value blank.  Click Okay and Apply.

C++ 11 Symbols

You will be asked to rebuild the catalogue.  Just click yes.  You should now be able to compile C++ 11 code under Eclipse.

Leave a Reply

Your email address will not be published. Required fields are marked *