我有一个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)中制作一个二进制文件。