gcc Record
gcc -E file1.c > output
gcc -E file1.c -o file1.i
gcc -S file1.i -o file1.s
gcc -S file1.c # output file1.s
gcc -c file1.c
gcc -c file1.s
gcc file0.c file1.s file2.o
GCC include
- -I # gcc file1 -I include -I include1 ...
- $C_INCLUDE_PATH
- $CPLUS_INCLUDE_PATH
- 引用include的文件路径(仅限""引用)
- /usr/local/include/ 等
静态链接库
ar rcs libfile1.a file1.o
使用 gcc file0.c -L . -lfile1
GCC lib 搜索路径
- /usr/local/lib 等
- -L
动态链接库
gcc -shared -fPIC -c file1.c
gcc -shared -fPIC -o libfile1.so file1.o
- /usr/lib
- $LD_LIBRARY_PATH