gcc编译过程
2012-11-03 09:55
309 查看
[hayuk@localhost qinghua]$ touch hello.c
[hayuk@localhost qinghua]$ ls
hello.c
[hayuk@localhost qinghua]$ vim hello.c
[hayuk@localhost qinghua]$ ls
hello.c
// 预处理 替换宏
[hayuk@localhost qinghua]$ gcc -E hello.c -o hello.i
[hayuk@localhost qinghua]$ ls
hello.c hello.i
// 编译 检查语法
[hayuk@localhost qinghua]$ gcc -S hello.i -o hello.s
[hayuk@localhost qinghua]$ ls
hello.c hello.i hello.s
// 汇编 生成机器语言
[hayuk@localhost qinghua]$ gcc -c hello.s -o hello.o
[hayuk@localhost qinghua]$ ls
hello.c hello.i hello.o hello.s
// 链接 链接.o文件或和外部链接库,生成可执行文件
[hayuk@localhost qinghua]$ gcc hello.o -o hello
[hayuk@localhost qinghua]$ ls
hello hello.c hello.i hello.o hello.s
// 执行
[hayuk@localhost qinghua]$ ./hello
hello, gcc!
[hayuk@localhost qinghua]$ ls
hello hello.c hello.i hello.o hello.s
[hayuk@localhost qinghua]$ ls
hello.c
[hayuk@localhost qinghua]$ vim hello.c
// liangxiaxu@126.com #include <stdio.h> int main(void) { printf("hello, gcc!\n"); return 0; } // vim: set tabstop=4 shiftwidth=4 expandtab:
[hayuk@localhost qinghua]$ ls
hello.c
// 预处理 替换宏
[hayuk@localhost qinghua]$ gcc -E hello.c -o hello.i
[hayuk@localhost qinghua]$ ls
hello.c hello.i
// 编译 检查语法
[hayuk@localhost qinghua]$ gcc -S hello.i -o hello.s
[hayuk@localhost qinghua]$ ls
hello.c hello.i hello.s
// 汇编 生成机器语言
[hayuk@localhost qinghua]$ gcc -c hello.s -o hello.o
[hayuk@localhost qinghua]$ ls
hello.c hello.i hello.o hello.s
// 链接 链接.o文件或和外部链接库,生成可执行文件
[hayuk@localhost qinghua]$ gcc hello.o -o hello
[hayuk@localhost qinghua]$ ls
hello hello.c hello.i hello.o hello.s
// 执行
[hayuk@localhost qinghua]$ ./hello
hello, gcc!
[hayuk@localhost qinghua]$ ls
hello hello.c hello.i hello.o hello.s
相关文章推荐
- GCC编译过程
- 结合"hello world"探讨gcc编译程序的过程
- GCC 编译过程及每个过程做了那些事(收集)
- arm-linux-gcc 4.3.2编译安装过程
- Ubuntu12.04嵌入式交叉编译环境arm-linux-gcc搭建过程,图解
- gcc的编译过程
- Ubuntu 14.04 LTS嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- 用gcc编译成可执行程序细节过程
- gcc 编译过程
- GCC编译过程
- gcc编译过程详解
- 深度剖析“GCC编译器编译过程”
- gcc 从语言编译全过程 预处理---->编译---->汇编----->链接
- 【Linux】gcc编译过程及操作
- Ubuntu14.04下嵌入式交叉编译环境arm-linux-gcc-4.3.3搭建过程
- gcc/g++ 实战之编译的四个过程
- ubuntu14.04下编译linux uboot和kernel时提示arm-linux-gcc: not found 的解决过程
- ubuntu12.04 嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- 我的arm-gcc工具编译安装过程
- GCC编译程序过程