Muokkaa

Jaa


/Fp (Name .pch file)

Provides a path name for a precompiled header instead of using the default path name.

Syntax

/Fppathname

Remarks

Use the /Fp option with /Yc (Create Precompiled Header File) or /Yu (Use Precompiled Header File) to specify the path and file name for the precompiled header (PCH) file. By default, the /Yc option creates a PCH file name by using the base name of the source file and a pch extension.

If you don't specify an extension as part of the pathname, an extension of pch is assumed. When you specify a directory name by use of a slash (/) at the end of pathname, the default file name is vcversion0.pch, where version is the major version of the Visual Studio toolset. This directory must exist, or error C1083 is generated.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > C/C++ > Precompiled Headers property page.

  3. Modify the Precompiled Header Output File property.

To set this compiler option programmatically

Examples

To create a separate named version of the precompiled header file for the debug build of your program, you can specify a command such as:

CL /DDEBUG /Zi /Yc /FpDPROG.PCH PROG.CPP

The following command specifies the use of a precompiled header file named MYPCH.pch. The compiler precompiles the source code in PROG.cpp through the end of MYAPP.h, and puts the precompiled code in MYPCH.pch. It then uses the content of MYPCH.pch and compiles the rest of PROG.cpp to create an .obj file. The output of this example is a file named PROG.exe.

CL /YuMYAPP.H /FpMYPCH.PCH PROG.CPP

See also

Output-File (/F) Options
MSVC Compiler Options
MSVC Compiler Command-Line Syntax
Specifying the Pathname