Next: , Previous: , Up: How the compiler works   [Contents][Index]


12.2 The preprocessor

The first stage of the compilation process is the use of the preprocessor to expand macros and included header files. To perform this stage, GCC executes the following command:41

$ cpp hello.c > hello.i

The result is a file hello.i which contains the source code with all macros expanded. By convention, preprocessed files are given the file extension .i for C programs and .ii for C++ programs. In practice, the preprocessed file is not saved to disk unless the -save-temps option is used.


Footnotes

(41)

As mentioned earlier, the preprocessor is integrated into the compiler in recent versions of GCC. Conceptually, the compilation process is the same as running the preprocessor as separate application.