title | description | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
/Fp (Name .pch file) |
Use the /Fp compiler option to specify the precompiled header file name. |
05/31/2019 |
|
|
0fcd9cbd-e09f-44d3-9715-b41efb5d0be2 |
Provides a path name for a precompiled header instead of using the default path name.
/Fppathname
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.
-
Open 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++ > Precompiled Headers property page.
-
Modify the Precompiled Header Output File property.
- See xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A.
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
Output-File (/F) Options
MSVC Compiler Options
MSVC Compiler Command-Line Syntax
Specifying the Pathname