gcc编译C语言程序的执行过程

对于初学c编程的同学来说,学会如何使用gcc编译器工具,对理解c语言的执行过程,加深对这门语言的理解很重要

1. 创建 编程文件 hello.c文件 

[root@wahoo test]# vim hello.c

#include

#define DISPLAY "hello c!"

int main(void)

{

    printf("Hello Wrold!\n”);

    return 0;

}

2.编译hello.c文件为hello文件

找个过程分为

1)预编译 hello.c文件为hello.i文件 gcc -E hello.c -o hello.i 

2)编译  hello.i文件为 hello.s         gcc -S hello.i -o hello.s

3)汇编 hello.s 为hello.o                gcc -c hello.i -o hello.o

4)连接 hello.o为hello                    gcc  hello.o -o hello

gcc编译C语言程序的执行过程_第1张图片

3.执行hello文件 ./hello

你可能感兴趣的:(GCC编译)