Reputation: 3576
I'm running Ubuntu 16.04 and just opened my freshly installed Eclipse CDT Oxygen for the first time.
I imported an existing C++ project that builds fine using a CMake file that sets add_definitions(-std=c++11)
.
I used CMake with the command cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../src/
to generate Eclipse project files and then used those to import the project into Eclipse.
Now I'm looking at a source file in my newly imported project inside Eclipse and see a ton of issues. It's all types that cannot be resolved, for example std::default_random_engine
.
My guess is that Eclipse doesn't have the right toolchain configured.
I have a few questions:
How can I see the toolchain for my project and how can I change it? I looked up this help article, but the sections in the project properties menu I see are not the same as in the help article. The project properties menu I see does not have a "C/C++ Build" section. How can that be?
The CMake file that I used to generate the Eclipse project files specifies that C++11 is supposed to be used, so why isn't this the case then?
Here is what my project properties menu looks like:
This is what my .project
file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>particle_filter</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
Thanks a lot!
Upvotes: 0
Views: 1117
Reputation: 52809
I think CMake's CDT project generator is fairly out of date and doesn't configure the generated project properly for C++11 support.
I recommend the following approach for configuring C++11 support:
Project Properties | C/C++ General | Preprocessor Include Paths
.Providers
tab, select CDT GCC Built-in Compiler Settings
.-std=c++11
to the "Command to get compiler specs".After doing this, C++11 symbols should be resolved properly.
Upvotes: 1
Reputation: 34255
The missing C/C++ Build section can be caused by a broken .project
, .cproject
or .settings/language.settings.xml
file:
.project
, the .cproject
and the .settings/language.settings.xml
files with the corresponding files of the new project to find the problem (make sure to use same IDs in .cproject
and in .settings/language.settings.xml
, but different IDs than in other projects)Upvotes: 2