Question

I am using Eclipse (Kepler) with the CDT (8.2.1) plugin for C++ development. My problem is that when I create a new class (New->Class) the default include in the X.cpp file which should be #include "X.h" actually is #include "C:X.h". The same thing happens when I use the 'Organize Includes' function of CDT.

I was unable to find the reason for this behaviour. I would be really grateful if anyone could help me with this issue.

Was it helpful?

Solution

I had this problem too, I had created a new empty C++ project. then created my src folder and started adding classes and folders as normal. The solution i found was to set up the C++ include paths.

For those who do not know how to do that what i did was : make sure your open project is selected in eclipse go to : "project" > "properties" > "C/C++ Build" > "Settings"

Then add include paths within "GCC C++ Compiler" > "Includes"

I am using workspace relative paths so i need this entry to exist: "${workspace_loc:/${ProjName}/src}"

Then beyond that add any other folders you need to access header files within.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top