15. Source Files and Programs

Form must follow function.

– Le Corbusier

Separate Compilation


File-Local Names; Header Files; The One-Definition Rule; Standard-Library Headers; Linkage to Non-C++ Code; Linkage and Pointers to Functions

Using Header Files

Single-Header Organization; Multiple-Header Organization; Include Guards


Initialization of Nonlocal Variables; Initialization and Concurrency; Program Termination


15.1. Separate Compilation

Any realistic program consists of many logically separate components (e.g., namespaces; Chapter 14). To better manage these components, we can represent the program as a set of (source code) files where each file contains one or more logical components. Our task is to devise ...

Get The C++ Programming Language, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.