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

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

[[email protected] test]# vim hello.c

#include <stdio.h>

#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语言程序的执行过程

3.执行hello文件 ./hello

相关文章:

  • 2021-12-19
  • 2021-11-11
  • 2021-12-19
  • 2021-08-18
  • 2021-06-26
  • 2021-12-15
  • 2021-12-26
猜你喜欢
  • 2021-12-19
  • 2022-12-23
  • 2021-05-10
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案