程序的生成过程分为两步:
Linux编译与链接的过程

1.编译:compile,将*.cpp->*.o
2.链接:link,将所有的*.o->executable

编译:
g++ -c main.cpp -o main.o
g++ -c other.cpp -o other.o
(-c表示compile,不是link)

链接:
g++ main.o other.o -o helloworld

使用nm命令可以查看中间文件.o和最终程序里的符号

观察main.o的符号...
U:undefined    T:text,如XXXX函数名,ii为参数列表(int int) v表示void

Logo

更多推荐