C++ 的编译过程

Recall that g++ is not actually the C++ compiler – it is a driver program that hides a lot of the complexity of the compilation process from us. What is actually going on here is:

  • The C++ preprocessor is called to handle things like #include.
  • Preprocessed text is passed to the actual C++ compiler, which produces compiled assembly language code.
  • The assembly language code is assembled by the GCC assembler, producing an object code file.
  • The object code file is linked with the C++ libraries by the linker to produce the final executable.
  • The intermediate files are disposed of.

  • 调用 C++ 预处理器来处理 #include 等问题。
  • 预处理的文本传递给实际的 C++ 编译器, 它生成编译的汇编语言代码。
  • 汇编语言代码由 GCC 汇编程序组装, 生成一个对象代码文件。
  • 链接器将对象代码文件与 C++ 库链接, 以生成最终可执行文件。
  • 中间文件被释放。

猜你喜欢

转载自www.cnblogs.com/lion-zheng/p/10586088.html