我有一个Eclipse C++项目,它最初有
first.cpp
. 那么
second.cpp
已添加并应链接到原始文件。使用Eclipse构建工具,我得到以下输出:
make all
Building file: ../src/first.cpp
Invoking: GCC C++ Compiler
g++ -I/home/workspace/first/src -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/first.d" -MT"src/first.o" -o "src/first.o" "../src/first.cpp"
Finished building: ../src/first.cpp
Building file: ../src/second.cpp
Invoking: GCC C++ Compiler
g++ -I/home/workspace/first/src -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/second.d" -MT"src/second.o" -o "src/second.o" "../src/second.cpp"
Finished building: ../src/second.cpp
Building target: first
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "first" ./src/first.o ./src/second.o
Finished building target: first
如何让Eclipse以这种方式编译?
g++ first.cpp second.cpp -o first
非常感谢。
============================================================================
building multiple binaries with multiple source files
.