I have two c++ projects in Eclipse CDT main and shared. In shared i have a header called calc.h. I want to use this header in main, so i did the following:
- added
#include "calc.hto the relevant files in main - In main‘s
properties -> Project referencesi checked of shared
I hoped this would work, but I get a fatal error: calc.h: No such file or directory when compiling, so the project reference somehow doesn’t work.
I can get it to work by manually adding shared‘s source folder in main‘s properties->C/C++ Build->Setting->GCC C++Compiler->Includes, but my i have a bad feeling that this will become cumbersome on larger projects more complex dependencies. I’ll therefore hoped that Eclipse could handle this via project references.
Am I missing something or is manually the only way?
You are right, that is the way to do it!
I use Eclipse CDT on large projects, but I don’t use the Eclipse compiler settings. There are some drawbacks to using the CDT compiler’s settings:
I use CMake to manage my Eclipse projects. When I start a new project, I do the following steps:
CMake is THE compiler configuration tool to manage projects… If you don’t know this I encourage you to discover it.
Cheers!