Techopedia Explains Compilation Unit
The compilation unit incorporates the files included using the #include preprocessor directive as part of it. However, it does not incorporate the source lines that are skipped due to the conditional inclusion preprocessor directives.
Compilation units are crucial to identify the scope of identifiers, and to determine the linkage of identifiers with other external and internal identifiers.
A compilation unit may relate to functions or data in other compilation units in the below given means:
- A function in one compilation unit could very well call a function in a completely different compilation unit.
- External linkage can be assigned to data objects to ensure that other compilation units can access them.
Programs comprised of more than a single compilation unit could be compiled individually, and then later linked to create the executable program. A legitimate C compilation unit includes no less than one external declaration.