G++编译期间的四个过程
编写文件mian.cpp,代码示例是 https://www.cnblogs.com/zjiaxing/p/5557549.html 中的。 1 #include <iostream> 2 using namespace std; 3 #define pi 3.14 4 static int t = 1; 5 //这个注释是用来解释g++ -E预处理的过程的 6 int main() 7 { 8 cout<<"Hello world: the t+pi" << t+pi<<endl; 9 return 0; 10 } 第一步 预处理 执行如下 g++ -E main.cpp > main.i 会生成预处理文件,可以打开看看,一共生成了18150行,截取前十行如下 # 1 "main.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "main.cpp" # 1 "/usr/local/include/c++/5.4.0/iostream" 1 3 # 36 "/usr/local/include/c++/5.4.0/iostream" 3 # 37 "/usr/local/include/c++/5.4.0