c/c++学习笔记01
第4节in
1、查看gcc版本命令
gcc -v(需要先添加环境变量)
2、gcc编译c代码文件
gcc 目录\hello.c -o 目录\hello.exe
3、运行对应c程序
hello
4、分步编译
预处理:gcc -E hello.c -o hello.i
#include <stdio.h> int main() { #if xxx条件 printf("hello\n"); #endif return 0; }
当使用gcc -E hello.c -o hello.i预处理代码时,上方代码printf语句就会被忽略;当使用gcc -E hello.c -o hello.i -Dxxx条件,printf语句就会生成到代码里
编译:gcc -S hello.i -o hello.s
汇编:gcc -c hello.s -o hello.o
链接:gcc hello.o -o hello
5、system库函数
在程序中启动另一个程序