Enable C++11 standard for GCC on Eclipse CDT
Eclipse CDT to write
C++, we noticed that it did not enable by default the
C++11 standard. Following the steps below, we added the
-std=c++11 flag on the
GCC C++ Compiler command line arguments enabling the standard for our use.
- From the main window of Eclipse, on the list on the left, where your projects are listed, right click on your project and then click Properties from the new menu
- In the new window, navigate from the list on the left and expand the C/C++ Build option to view its children and then click the Settings item
- In the middle of the window, you will see a new list, expand (if needed) the item GCC C++ Compiler and click on the Miscellaneous child
- On the right, a text box named Other Flags will appear, append
-std=c++11to the list of tokens in the box as seen in the image below
- Click on the Apply button for the effects to take place and then the OK button to close the properties window
Next time you compile, the
-std=c++11 flag will be present on your compiler command line and the
C++11 standard will be used.