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.
Eclipse CDT (C/C++ Development Tooling) The CDT Project provides a fully functional C and C++ Integrated Development Environment based on the Eclipse platform.
I found this article in the Eclipse forum, just followed those steps and it works for me. I am using Eclipse Indigo 20110615-0604 on Windows with a Cygwin setup.
-std=c++0x
(or for newer compiler version -std=c++11
at the end . ... instead of GCC C++ Compiler I have also Cygwin compiler__GXX_EXPERIMENTAL_CXX0X__
(ensure to append and prepend two underscores) into "Name" and leave "Value" blank.There is a description of this in the Eclipse FAQ now as well: Eclipse FAQ/C++11 Features.
Eclipse image setting
First, before creating project, configure Eclipse syntax parser:
Window
-> Preferences
-> C/C++
-> Build
-> Settings
-> Discovery
-> CDT GCC Build-in Compiler Settings
in the text box entitled Command to get compiler specs
append -std=c++11
Now you can create project, configuration depends on what kind of project you created:
For project created as: File -> New -> Project -> C/C++ -> C++ Project
Right click on created project and open
Properties
-> C/C++ Build
-> Settings
-> Tool Settings
-> GCC C++ Compiler
-> Dialect
Put -std=c++11
into text box entitled other dialect flags
or select ISO C++11
from the Language standard
drop down.
For CMake project
Generate eclipse project files (inside your project)
mkdir build
cd build
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..
Then import generated directory to eclipse as standard eclipse project. Right click project and open
Properties
-> C/C++ General
-> Preprocessor Include Paths, Marcos etc.
-> Providers
enable CDT GCC Build-in Compiler Settings
and move it higher than Contributed PathEntry Containers
(This is important)
Last Common Step
recompile, regenerate Project
->C/C++ Index
and restart Eclipse.
Update 2016:
As of gcc 6 (changes), the default C++ dialect is C++14. That means that unless you explicitly need a newer or older dialect than than, you don't need to do anything with eclipse anymore.
This community wiki section incorporates the answer by Trismegistos;
1. Before creating project, configure Eclipse syntax parser:
Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC Build-in Compiler Settings
in the text box entitled Command to get compiler specs append -std=c++14
2. Create project, configuration depends on what kind of project you created:
For project created as: File -> New -> Project -> C/C++ -> C++ Project
Right click on created project and open
Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Dialect
Put -std=c++14
into text box entitled other dialect flags or select ISO C++11 from the Language standard drop down.
For most recent versions: (Currently Juno and Kepler Luna):
Under newer versions of Juno the settings are located at Project properties -> C/C++ General -> Preprocessor Include Paths, Macros etc. -> tab Providers -> CDT GCC Builtin Compiler Settings ()
.
Older versions 2012/2013:
Under C/C++ Build (at project settings), find the Preprocessor Include Path and go to the Providers Tab. Deselect all except CDT GCC Builtin Compiler Settings. Then untag Share settings entries … . Add the option -std=c++11 to the text box called Command to get compiler specs.
Go to paths and symbols. Under Symbols, click restore defaults, and then apply.
Notes:
Eclipse is picky about hitting apply, you need to do it every time you leave a settings tab.
[Self-promotion]: I wrote my own more detailed instructions based on the above. http://scrupulousabstractions.tumblr.com/post/36441490955/eclipse-mingw-builds
Thanks to the user Nobody
at https://stackoverflow.com/a/13635080/1149664
For the latest (Juno) eclipse cdt the following worked for me, no need to declare __GXX_EXPERIMENTAL_CXX0X__
on myself. This works for the the CDT indexer and as parameter for the compiler:
"your project name" -> right click -> properties:
C/C++ General -> Preprocessor Include Paths, Macros etc. -> switch to the tab named "Providers":
for "Configuration" select "Release" (and afterwards "debug")
switch off all providers and just select "CDT GCC Built-in Compiler Settings"
uncheck "Share setting entries between projects (global provider)"
in the "Command to get compiler specs:" add "-std=c++11" without the quotes (may work with quotes too)
hit apply and close the options
rebuild the index
Now all the c++11 related stuff should be resolved correctly by the indexer.
win7 x64, latest official eclipse with cdt mingw-w64 gcc 4.7.2 from the mingwbuilds project on sourceforge
I had the same problem on my Eclipse Juno. These steps solved the problem :
Project -> Properties -> C/C++ General -> Path and Symbols -> Tab [Symbols]
. For Eclipse CDT Kepler what worked for me to get rid of std::thread
unresolved symbol is:
Go to Preferences->C/C++->Build->Settings
Select the Discovery tab
Select CDT GCC Built-in Compiler Settings [Shared]
Add the -std=c++11 to the "Command to get the compiler specs:" field such as:
${COMMAND} -E -P -v -dD -std=c++11 ${INPUTS}
Adding -std=c++11
to project Properties/C/C++ Build->Settings->Tool Settings->GCC C++ Compiler->Miscellaneous->Other
Flags wasn't enough for Kepler, however it was enough for older versions such as Helios.
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