Eclipse CDT: Restore Dependent Project

I am working on a C ++ project with eclipse Indigo + CDT running on Linux

It consists of a project for a library and a unit test project for this library.
Obviously, the second project depends on the first. Both projects use an external constructor

But when I change the title of the first project, it does not rebuild the test project. And I can’t get it done ... It will simply reconfigure the second project, even if the title is included in the test project. This is very annoying because I often have assembly work while working on the library, after which at some point I do a complete rebuild, and I see a lot of errors on what I did 30 minutes ago!

CDT Global Build Console sample output:

**** Build of configuration Debug for project libxxx **** make -j all Building file: ../foo.cpp Invoking: GCC C++ Compiler ccache g++ -I"/home/foke/workspaces/cpp/libxxx/include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"foo.d" -MT"foo.d" -o "foo.o" "../foo.cpp" Finished building: ../foo.cpp Building target: libxxx.a Invoking: GCC Archiver ar -r "libxxx.a" ./foo.o ./src/yyy.o ./src/detail/zzz.o ar: creating libxxx.a Finished building target: libxxx.a **** Build Finished **** **** Build of configuration Debug for project libxxx_tests **** make -k -j all Building target: libxxx_tests Invoking: Cross G++ Linker g++ -L"/home/foke/workspaces/cpp/libxxx/Debug" -o "libxxx_tests" ./main.o ./aaa.o ./tests/bbb.o ./tests/ccc.o ./tests/ddd.o -lboost_unit_test_framework -lxxx Finished building target: libxxx_tests **** Build Finished **** 
+4
source share
1 answer

If you are used to the latest versions of MS Visual Studio, then you should free up space on your desk and mark it with a giant "X" - this is inevitable when your fist and maybe even your head will be disappointed when using eclipse / CDT.

Eclipse has its own dependency mechanism, which does almost nothing, but, fortunately, the CDT module has its own dependency mechanism, which tries to do what you want. To configure project dependencies:

 Project-->Properties-->C/C++ General-->Paths and Symbols-->References 

So, in your example, you will go to the project properties for "libxxx_tests" and select "libxxx.a" as the dependency.

Please note that you can also use this page to set the order of libraries, which can be an important step depending on the complexity of your project.

+4
source

All Articles