What is a "translation unit" in C++



A translation unit is any preprocessed source file.

A translation unit is the basic unit of compilation in C++. This unit is made up of the contents of a single source file after it passes through preprocessing. It contains included any header files without blocks that are ignored using conditional preprocessing statements like ifdef, ifndef, etc.

A single translation unit can be compiled into an object file, library, or executable program.



Advertisements