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++ 庫連接, 以生成最終可執行文件。
- 中間文件被釋放。