C++编译过程

test.cpp (预编译器: 头文件copy 宏替换等)> test.i (编译器)> test.s(汇编文件) (汇编器)> test.obj/test.o(目标文件) (链接器)> test.exe/test(可执行文件)

  • test.cpp
#include <iostream>
#define PI 3.1415926

int main(int argc, char* argv[])
{
  std::cout << "PI is: " << PI << std::endl;
  return 0;
}
  • 预编译
g++ -E test.cpp -o test.i
  • 编译
g++ -S test.i -o test.s
  • 汇编
g++ -C test.s -o test.o
  • 可执行文件
g++ test.s -o test
file test
posted @   半夜打老虎  阅读(51)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
点击右上角即可分享
微信分享提示