尝试将对象文件与静态库链接并生成二进制输出时的编译问题

时间:2017-12-06 12:52:27

标签: c++ compiler-errors compilation linker-errors static-linking

gcc -c -o app main.o build/service.o -std=c++11 -lstdc++ -lboost_system -lboost_thread -lpthread simulation_tool.a 
gcc: warning: main.o: linker input file unused because linking not done
gcc: warning: build/service.o: linker input file unused because linking not done
gcc: warning: simulation_tool.a: linker input file unused because linking not done

gcc -o app main.o build/service.o -std=c++11 -lstdc++ -lboost_system -lboost_thread -lpthread simulation_tool.a 
build/service.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

当我给出-c选项时,我得到链接警告,因为-c无法链接,但没有-c选项我无法生成编译选项错误的二进制输出?

我正在尝试链接.a文件和目标文件,并在上面的编译中生成二进制文件作为输出

0 个答案:

没有答案