← All Posts

C++ Project Structure

Why This Series Exists

Writing a C++ program from scratch is not only about syntax. You also need to know where files go, what belongs in headers, what belongs in .cpp files, how declarations and definitions connect, what the compiler produces, and why the linker fails with errors like "undefined reference" or "multiple definition".

This series treats those topics as project-management fundamentals. The C++ language series can focus on language features, while this From Scratch series explains how real C++ projects are physically organized and built.

The Mental Model

headers (.h/.hpp) declare what exists source files (.cpp) define how it works compiler turns each .cpp into an object file linker combines object files into an executable build system remembers the commands and dependencies

If you understand those five lines, most C++ build errors become much easier to debug.

Recommended Reading Order