Preprocessing Only

Use either the -E or the -P option to preprocess your source files without compiling them.

When you specify the -E option, the compiler's preprocessor expands your source module and writes the result to standard output. The preprocessed source contains #line directives, which the compiler uses to determine the source file and line number during its next pass. For example, to preprocess two source files and write them to stdout, enter the following command:

When you specify the -P option, the preprocessor expands your source module and stores the result in a file in the current directory. There is no way to change the default name. The preprocessor uses the name of each source file with the .i extension. For example, the following command creates two files named prog1.i and prog2.i, which you can use as input to another compilation:

The -EP option can be used in combination with -E or -P. It directs the preprocessor to not include #line directives in the output. Specifying -EP alone is the same as specifying -E -EP.

Caution

When you use the -P option, any existing files with the same name and extension are overwritten.

Preserving Comments in Preprocessed Source Output

Use the -C option to preserve comments in your preprocessed source output.