GCC compiler
- Regardless of gcc or g++, C programs can be compiled, and the rules and parameters of compiling programs are the same;
- g++ can directly compile C++ programs, gcc compiles C++ programs need to add additional parameters -lstdc++
- Either gcc or g++ can define __cplusplus
In actual use:
# 使用gcc指令编译C代码
#只用g++指令编译C++代码
#例如:
g++ test.cpp -o test
compilation process
- Preprocessing-Pre-Processing //.i file
# -E 选项指示编译器仅对输入文件进行预处理
g++ -E test.cpp -o test.i //i文件
- Compile-Compilling //.s file
# -s 编译选项告诉g++在为c++代码产生了汇编语言文件后停止编译