C++/Tips

[C++] Compilation Process

메리사츠 2021. 6. 25. 18:26

0. Overview

=> Project.cpp 라 가정

1. Preprocessing

=> Preprocessor(전처리기)가 처리하는 과정

=> #include 와 #define과 같은 전처리기 지시를 처리

=> C++ 구문에 구애받지 않음

=> Header file을 inline시킴

=> #if 및 #error를 사용하여 오류 구분 가능

=> 산출물 : Project.i

2. Compilation

=> Compiler + Assembler가 처리하는 과정

=> C++ 소스 코드를 구문분석하여 Assembly code로 변환

=> code를 machine code로 조합하여 binary code 생성

=> 산출물 : Project.s -> Project.o

3. Linking

=> Linker가 처리하는 과정

=> .o 파일에서 최종 컴파일 출력을 생성

=> 산출물 : Project