I am trying to find a way to get full C++11 support on Eclipse.
In Eclipse Juno I had a lot of new features with __GXX_EXPERIMENTAL_CXX0X__
but I didn't find support for std::threads
, std::mutex
, etc.
How can I have completion for all C++11 functions?
EDIT : Solution
Go to Project -> Properties -> C/C++ General -> Path and Symbols -> Tab [Symbols]
.
Add the symbol : __cplusplus with the value 201103L
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.
In the About Eclipse dialogue, click the Installation Details button. The Eclipse Installation Details dialogue appears. In the list of installed software, you should see "C/C++ Development Tools". The version displayed in the version column is the version of CDT.
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" ⇒ ...
In Eclipse, go to the "File" menu, then "New", then "C++ Project" if it's there. If not, choose "Project", then find "C/C++" in the list of wizards, click the "+" sign to expand it, and choose "C++ Project". A dialog box will ask whether to open the C/C++ perspective.
Eclipse works with C+11 support (Indexer and such) just fine: both Juno and Kepler. The thing is that you have to let Eclipse know that you are going to compile with C++11 support. This is done by providing additional flag -std=c++11
to CDT GCC Builtin Compiler Settings
in C/C++ -> Build -> Settings -> Discovery [tab]
so it will read something like:
${COMMAND} -E -P -v -dD "${INPUTS}" -std=c++11
And that is all you have to do with Kepler/Juno to get C++11 code highlighted correctly.
Note, this is workspace-wide setting. You can do the same on per project basis if you don't want to set it in workspace.
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