You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provides a path name for a precompiled header instead of using the default path name.
11
12
@@ -15,39 +16,33 @@ Provides a path name for a precompiled header instead of using the default path
15
16
16
17
## Remarks
17
18
18
-
Use this option with [/Yc (Create Precompiled Header File)](yc-create-precompiled-header-file.md) or [/Yu (Use Precompiled Header File)](yu-use-precompiled-header-file.md) to provide a path name for a precompiled header instead of using the default path name. You can also use **/Fp** with **/Yc**to specify the use of a precompiled header file that differs from the **/Yc**<em>filename</em> argument and from the base name of the source file.
19
+
Use the **/Fp**option with [/Yc (Create Precompiled Header File)](yc-create-precompiled-header-file.md) or [/Yu (Use Precompiled Header File)](yu-use-precompiled-header-file.md) 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.
19
20
20
-
If you do not specify an extension as part of the path name, an extension of .pch is assumed. If you specify a directory without a file name, the default file name is VC*x*0.pch, where *x* is the major version of Visual C++ in use.
21
-
22
-
You can also use the **/Fp** option with **/Yu**.
21
+
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 vc*version*0.pch, where *version* is the major version of the Visual Studio toolset. This directory must exist, or error C1083 is generated.
23
22
24
23
### To set this compiler option in the Visual Studio development environment
25
24
26
25
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
27
26
28
-
1. Click the **C/C++** folder.
29
-
30
-
1. Click the **Precompiled Headers** property page.
27
+
1. Open the **Configuration Properties** > **C/C++** > **Precompiled Headers** property page.
31
28
32
-
1. Modify the **Precompiled Header File** property.
29
+
1. Modify the **Precompiled Header Output File** property.
33
30
34
31
### To set this compiler option programmatically
35
32
36
-
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.PrecompiledHeaderFile%2A>.
33
+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
37
34
38
-
## Example
35
+
## Examples
39
36
40
-
If you want to create a precompiled header file for a debugging version of your program and you are compiling both header files and source code, you can specify a command such as:
37
+
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:
41
38
42
-
```
39
+
```CMD
43
40
CL /DDEBUG /Zi /Yc /FpDPROG.PCH PROG.CPP
44
41
```
45
42
46
-
## Example
43
+
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.
47
44
48
-
The following command specifies the use of a precompiled header file named MYPCH.pch. The compiler assumes that the source code in PROG.cpp has been precompiled through MYAPP.h and that the precompiled code resides in MYPCH.pch. It 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.
0 commit comments