Eclipse CDT C/C++: Include a header file from another project

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:

  • As you said, on large projects, it is cumbersome.
  • If you want to compile your project on a platform which doesn't have Eclipse (when you deploy your application), it is not straightforward.

I use CMake to manage my Eclipse projects. When I start a new project, I do the following steps:

  1. In a terminal, create a folder for your new project.
  2. With your favorite text editor (vim, emacs, Text edit, kate, etc...) create the CMakeLists.txt file for your project. You don't have to create an exhaustive CMakeLists, just a small CMakeLists for your first files is enough.
  3. Then, ask cmake to generate the Eclipse project like this:
    cmake -G "Eclipse CDT41. Unix Makefiles"
    
  4. Open Eclipse, click on File --> Import, and choose "General/Existing project into workspace". Choose the folder created in the first step, and your project is ready to use in eclipse.

CMake is THE compiler configuration tool to manage projects... If you don't know this I encourage you to discover it.

Cheers!