Preprocessing Only

Use the -E, -P or -EP option to preprocess your source files without compiling them. When using these options, only the preprocessing phase of compilation is activated.

Using -E

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

prompt>icpc -E prog1.cpp prog2.cpp

Using -P

When you specify the -P option, the preprocessor expands your source module and directs the output to a .i file instead of stdout. Unlike the -E option, the output from -P does not include #line number directives. By default, the preprocessor creates the name of the output file using the prefix of the source file name with a .i extension. You can change this by using the -ofile  option. For example, the following command creates two files named prog1.i and prog2.i, which you can use as input to another compilation:

prompt>icpc -P prog1.cpp prog2.cpp

Caution

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

Using -EP

Using the -EP option directs the preprocessor to not include #line directives in the output. -EP is equivalent to -E -P.

prompt>icpc -EP prog1.cpp prog2.cpp

Preserving Comments in Preprocessed Source Output

Use the -C option to preserve comments in your preprocessed source output. Comments following preprocessing directives, however, are not preserved.