Eclipse CDT CDT project does not include system

My problem is similar to this: http://www.eclipse.org/forums/index.php/m/649323/

I created a cmake project and used

cmake .. -G "Eclipse CDT4 - Unix Makefiles"

to create an Eclipse CDT4 project.

But the standard included paths are not listed in the CDT IDE, and all STL or System build-in headers include directives labeled “cannot be resolved,” so “Open Declaration” or other major operation cannot be done.

However, I could compile it without any problems.

My colleague also has a cmake project, but it is very complicated. The CDT project, created from his cmake project, includes a system. But his cmake is too complicated, and he told me that he did nothing special to include the system paths.

Can anyone help me out? Thank.

My Main CMakeLists.txt:

CMake_Minimum_Required(VERSION 2.8)

# Some settings
Set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
CMake_Policy(SET CMP0015 NEW)

#Include(CMakeProcedures.cmake)
#CheckEnvironment()

# Set the compiler and its version if needed

# Create the project
Project(MyProjectName CXX)

# Set the compiler
Set(CMAKE_CXX_COMPILER /usr/bin/g++)

# Detect whether we are in-source
If (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
    Message(FATAL_ERROR "In-source building is not allowed! Please create a 'build' folder and then do 'cd build; cmake ..'")
EndIf()

# Set the output dirs
Set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
Set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

# Add source subdirs to the build
Add_Subdirectory(src)
# Add_Subdirectory(test EXCLUDE_FROM_ALL)

Peter

One way is to manually add them to the CDT IDE:

/usr/include/c++/4.5
/usr/include/c++/4.5/backward
/usr/include/c++/4.5/i686-linux-gnu
/usr/include/i386-linux-gnu
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include-fixed
/usr/local/include

But this is not a solution.

+5
source share
1 answer

It finally turned out that this line was causing the problem:

Project(MyProjectName CXX)

If we remove the optional CXX parameter, life will be good.

Can someone tell me why?

Peter

+1
source

All Articles