创建文件夹
#include<iostream>
using namespace std;
int main(){
cout<<"THis is C++ program Process!"<<endl;
}
编译执行命令:
g++ test.cpp -o test

实际上,上述的命令包含了如下的四个过程:

1. 预处理
g++ -E test.cpp -o test.i

其中:test.i文件内容
# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "test.cpp"
# 1 "/usr/include/c++/5/iostream" 1 3
# 36 "/usr/include/c++/5/iostream" 3
# 37 "/usr/include/c++/5/iostream" 3
# 1 "/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h" 1 3
# 194 "/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h" 3
# 194 "/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h" 3
namespace std
{
typedef long unsigned int size_t;
typedef long int ptrdiff_t;
}
2.编译:
g++ -S test.i -o test.s

test.s文件内容

3.汇编:
g++ -c test.s -o test.o

4.链接:
g++ test.o -o test


g++编译参数








man gcc #查看gcc命令手册
Cmake



宏定义:

头文件的本质:


if endf 编译的时候禁用还是使用代码










