Home | Overview | How Do I | Compiler Options
Use the /Fpfilename option with the /YX, /Yc, and /Yu options to provide a name for a precompiled header (.PCH) file (and path) that is different from the default. You can also use /Fp to specify the use of a .PCH file that is different from the filename argument to the /Yc option or the base name of the source file.
No space is allowed between /Fp and filename. If you do not specify an extension to filename, an extension of .PCH is assumed. If filename ends in a backslash (to specify the name of a directory), the default filename VC50.PCH is appended to filename.
The following command renames the default VC50.PCH file created and used by /YX:
CL /YX /FpMYPCH.PCH PROG.CPP
The following command creates a precompiled header file DPROG.PCH for a debugging version of a program:
CL /DDEBUG /Zi /Yc /FpDPROG.PCH PROG.CPP
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. Because none of these options suppresses the linker, the output of this example is a file named PROG.EXE.
CL /YuMYAPP.H /FpMYPCH.PCH PROG.CPP