The C++ build process is roughly as thus:
- All .cpp (and possibly .c) files are compiled:
- First the preprocessor processes the file, it (as required):
- Parses and processes all
#define
d macros, storing their definitions in a symbol table (a string to string dictionary). - Parses and processes all
#if
,#elif
and#endif
macros, thus performing conditional compilation. - Parses and processes all
#include
d header (.h
) files, which includes inserting the contents of the header file into the point at which it was #included (or performs a process that achieves the equivalent effect). - Parses and processes all
#pragma
s, implementing their compiler-specific behaviour.- Note that the most common and widely supported
#pragma
is#pragma once
, which acts as an alternative to include guards.
- Note that the most common and widely supported
- Parses and processes all
- First the preprocessor processes the file, it (as required):
- Other
#pragma
examples include#pragma omp
, which implements 'Open Multi-Processing'