Caffeinated Coder
Book an appointment
Lesson 24 · Building and performance

Headers, translation units and linking

A C++ program is built from many files, and the compiler never sees them all at once. Follow a three-file program, main.cpp, square.h and square.cpp, as each .cpp file and the headers it includes become one translation unit, compile on their own into object files with symbol tables, and meet again in the linker. Then break it on purpose: a missing definition, a doubled one, and see why separate compilation keeps big builds fast.

12 min11 steps5 questionsAdvanced
Fig 24 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.