How do you enable C++11 syntax in Eclipse Neon?

CPayne picture CPayne · Aug 25, 2016 · Viewed 22.1k times · Source

I am developing C+11 code in Eclipse Neon and noticed today that the range based for loop introduced in C+11 is highlighted red by the IDE indicating it does not recognize it.

I have found multiple links about how to do this for older versions of CDT such as this (Eclipse CDT C++11/C++0x support) You can see though there is no "Tool Settings" tab.

enter image description here

Can someone suggest how to configure my project so that C++11 syntax is correctly highlighted (I am using a separate build system)

Answer

Andreas DM picture Andreas DM · Aug 25, 2016
  1. Right click on your project and click Properties
  2. Navigate to C/C++ General and Preprocessor Include Paths, Macros etc.
  3. Select the Providers tab, click on compiler settings row for the compiler you use.
  4. Add -std=c++11 to Command to get compiler specs.
  5. Apply changes.

Will look something like this:

${COMMAND} -E -P -v -dD "${INPUTS}" -std=c++11