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.
Can someone suggest how to configure my project so that C++11 syntax is correctly highlighted (I am using a separate build system)
Launch Eclipse → Help → Install New Software → In "Work with" field, pull down the drop-down menu and select "Kepler - http://download.eclipse.org/releases/kepler" (or juno for Eclipse 4.2; or helios for Eclipse 3.7). In "Name" box, expand "Programming Language" node ⇒ Check "C/C++ Development Tools" ⇒ "Next" ⇒ ...
Eclipse is popular for Java project development. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins. Eclipse is cross-platform and runs under Windows, Linux and Mac OS.
Will look something like this:
${COMMAND} -E -P -v -dD "${INPUTS}" -std=c++11
You can also do the following
Alternatively,
For reasons I do not understand, when searching for clues as to why my Eclispe Oxygen + CDT 9.3.2 running on Fedora 27 could not reliably debug my code, Google put up this question / answer as something to look at.
Basically my problem has been that a fairly simply C++ program, using C++ 11 features (specifically shared_ptr), was un-debuggable in Eclipse Oxygen 2 + CDT 9.3.2 on top of Fedora 27 (which has gdb version 8.0.1 installed from the standard package repo). Stepping into a few method calls resulted in a hung debug session, nothing going on, terminate Eclipse to recover.
If I debugged the binary using gdb on the command line, all was good; I could set break points, etc, everything worked as it should. But from inside Eclipse, nothing doing.
However, putting -std=c++11 into the project settings as shown by Andreas solved the problem. I have very little idea why. I thought I'd put this up in case someone else ran into a similar problem.
g++ is at version 7.2.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With