gcc hello.c -o hello //输出hello文件
动态编译:
编译时不链接库
文件小,速度快
可移植性差
静态编译:
编译时链接库
文件大,速度慢
可移植性好
1.预处理: //处理(替换)文件#开头的代码
gcc -E hello.c -o hello.i
1).#include
2).#define
注释3).#ifndef #if 0
… …
define endif
2.编译:
gcc -S hello.i -o hello.s
1).语法检查
2).翻译汇编代码
3.汇编:
gcc -c hello.s -o hello.o
生成二进制文件
4.链接:
gcc hello1.o hello2.o hello3.o -o hello
链接要用的文件或文件库
gcc hello.c -o hello -I … //头文件在上一级找