/E
This option preprocesses C and C++ source files and copies the preprocessed files to the standard output device. In the process, all preprocessor directives are carried out, macro expansions are performed, and comments are removed. To preserve comments in the preprocessed output, use the /C option along with /E.
/E adds #line directives to the output, at the beginning and end of each included file and around lines removed by preprocessor directives for conditional compilation. These directives renumber the lines of the preprocessed file. As a result, errors generated during later stages of processing refer to the line numbers of the original source file rather than lines in the preprocessed file.
The /E option suppresses compilation. You must resubmit the preprocessed file for compilation. /E also suppresses the output files from the /FA, /Fa, and /Fm options.
To suppress #line directives, use the /EP option instead.
To send the preprocessed output to a file instead of to stdout, use the /P option instead.
To suppress #line directives and send the preprocessed output to a file, use /P and /EP together.
You cannot use precompiled headers with the /E option.
Note When preprocessing to a separate file, spaces are not emitted after tokens. This can result in an illegal program or have unintended side-effects. Consider the following program:
#define m(x) x m(int)main() { return 0; }
This program compiles successfully. However, if you compile with:
cl -E test.cpp > test2.cpp
int main
in test2.cpp will incorrectly be intmain
.
The following command-line preprocesses ADD.C
, preserves comments, adds #line directives, and displays the result on the standard output device:
CL /E /C ADD.C
Compiler Options | Setting Compiler Options