[领卓教育] 编译器 gcc

在Linux操作系统下用gcc编译程序

程序的编译分为四个阶段:

  • 预编译
  • 编译
  • 汇编
  • 链接

编译程序:

  • 一步到位:
    gcc hello.c -o hello
    运行程序:./hello

  • 分步骤完成:
    gcc -E hello.c -o hello.i // 预处理
    gcc -S hello.i -o hello.s // 编译
    gcc -c hello.s -o hello.o // 汇编
    gcc hello.o -o hello_elf// 链接

猜你喜欢

转载自blog.csdn.net/zx_1924557809/article/details/83547614