This documentation is archived and is not being maintained.

/E (Preprocess to stdout)


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 that 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
   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.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the C/C++ folder.
  3. Click the Command Line property page.
  4. Type the compiler option in the Additional Options box.

To set this compiler option programmatically

See GeneratePreprocessedFile Property.


The following command line preprocesses ADD.C, preserves comments, adds #line directives, and displays the result on the standard output device:


See Also

Compiler Options | Setting Compiler Options