Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies the name of the output file to which the /P
(Preprocess to a File) compiler option writes preprocessed output.
Syntax
/Fi
pathname
Parameters
pathname
The relative or absolute path and filename of the output file produced by the /P
compiler option. Or, the directory path for the .i
output files when more than one input file is specified. Don't put a space between the /Fi
option and pathname
.
Remarks
Use the /Fi
compiler option in combination with the /P
compiler option. If /P
isn't specified, /Fi
causes command line warning D9007.
If you specify only a directory path (a path that ends in a backslash \
) for the pathname
parameter, the base name of the source file is used as the base name of the preprocessed output file. The pathname
parameter doesn't require a particular file name extension. However, an extension of ".i" is used if you don't specify a file name extension.
Example
The following command line preprocesses PROGRAM.cpp
, preserves comments, adds #line
directives, and writes the result to the MYPROCESS.i
file:
CL /P /FiMYPROCESS.I PROGRAM.CPP
This command line preprocesses main.cpp
and helper.cpp
into main.i
and helper.i
in a subdirectory named preprocessed
:
CL /P /Fi".\\preprocessed\\" main.cpp helper.cpp
To set this compiler option in the Visual Studio development environment
Open the source file or the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
Select the Configuration Properties > C/C++ > Preprocessor property page.
Set the Preprocess to a File property to Yes.
Select the Configuration Properties > C/C++ > Command Line property page.
Enter the
/Fi
compiler option andpathname
in the Additional Options box. Only specify a directory path, not a filename, when setting this property for a project.
To set this compiler option programmatically
- See AdditionalOptions.
See also
MSVC compiler options
/P
(Preprocess to a file)
Specifying the pathname