Compilation Pipeline & Linker Errors

🟡 Intermediate

📖 Definition

The C++ build pipeline converts source files (.cpp) into preprocessed files, then machine object code (.o/.obj), and finally links all object files and libraries into a standalone executable. Missing definitions trigger linker errors (undefined reference to...).

💡 Code Example

# Separate compilation step
g++ -std=c++17 -c main.cpp -o main.o
g++ -std=c++17 -c utils.cpp -o utils.o

# Linker step
g++ main.o utils.o -o my_app