C++ User's Guide

Using Multiple Source Files

The C++ compiler accepts multiple source files on the command line. A single source file compiled by the compiler, together with any files that it directly or indirectly supports, is referred to as a compilation unit. C++ treats each source as a separate compilation unit. A single source file can contain any number of procedures (main program, function, module, and so on). There are advantages to organizing an application with one procedure per file, as there are for gathering procedures that work together into a single file. Some of these are described in C++ Programming Guide.