C语言_编译过程1.2

  • C语言编译过程

#include 和 #define不是关键字,这两个在预处理过程中进行执行。关键字只有在编译过程中进行翻译。

1.预处理过程 [-E]

头文件展开 #include <stdio.h>
宏定义展开 #define ABC
删除注释 //xxx
条件编译
---->hello.i文件

gcc hello.c -E -o hello.i

file a.i

2.编译过程 [-S]

检查语法
生成汇编语言。->a.s文件

gcc hello.i -S -o hello.s  //gcc a.c -S -o a.s 也是可以的。

file a.s

3.汇编过程 [-c]

生成机器语言
—>hello.o文件

gcc hello.s -c -o hello.o  //gcc a.c -c -o a.o 也是可以的
file hello.o

4.链接 [自动进行,无参数]

将库文件链接变成可执行文件

gcc a.o -o a //gcc a.c -o a.exe 也是可以的
 
发布了80 篇原创文章 · 获赞 0 · 访问量 1754

猜你喜欢

转载自blog.csdn.net/weixin_41272269/article/details/103730819
今日推荐