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++ 库链接, 以生成最终可执行文件。
  • 中间文件被释放。

posted on 2019-03-23 22:48  lion_zheng  阅读(180)  评论(0编辑  收藏  举报

导航