fok*_*oke 5 c++ eclipse build-process build eclipse-cdt
我正在开发一个 C++ 项目,在 linux 上运行 eclipse Indigo + CDT
它由一个库项目和一个包含该库单元测试的项目组成。
显然,第二个项目取决于第一个项目。
两个项目都使用外部构建器
但是,当我修改第一个项目的标头时,它不会重建测试项目。我无法让它做到这一点...它只会重新链接第二个项目,即使标头包含在测试项目中。这非常烦人,因为我经常在处理库时进行工作构建,然后在某个时候我进行完全重建,然后在我 30 分钟前所做的事情上看到大量错误!
CDT 全局构建控制台的示例输出:
**** 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 ****
Run Code Online (Sandbox Code Playgroud)
如果您习惯了最新版本的 MS Visual Studio,那么您应该在桌面上清理出一个空间,并用一个巨大的“X”标记它 - 这在使用 Eclipse 时不可避免地会让您的拳头甚至您的头感到沮丧。 /CDT。
Eclipse 有它自己的依赖机制,几乎什么都不做,但幸运的是 CDT 模块有它自己的依赖机制,它试图做你想做的事情。要设置项目依赖项,请转到:
Project-->Properties-->C/C++ General-->Paths and Symbols-->References
Run Code Online (Sandbox Code Playgroud)
因此,在您的示例中,您将转到“libxxx_tests”的项目属性并选择“libxxx.a”作为依赖项。
请注意,您还可以使用此页面来设置库顺序,这可能是一个重要的步骤,具体取决于项目的复杂性。
归档时间: |
|
查看次数: |
1817 次 |
最近记录: |