The name of the include file must be the same for both the /Yc option that creates the precompiled header and any subsequent /Yu option indicating use of the precompiled header.
For /Yc, filename specifies the point at which precompilation stops; the compiler precompiles all code though filename and names the resulting precompiled header using the base name of the include file and an extension of .pch.
The .pch file must have been created using /Yc.
The compiler treats all code occurring before the .h file as precompiled. It skips to just beyond the #include directive associated with the .h file, uses the code contained in the .pch file, and then compiles all code after filename.
On the command line, no space is allowed between /Yu and filename.
When you specify the /Yu option without a file name, your source program must contain a #pragma hdrstop pragma that specifies the file name of the precompiled header, .pch file. In this case, the compiler will use the precompiled header (.pch file) named by /Fp (Name .pch File). The compiler skips to the location of that pragma, restores the compiled state from the precompiled header file specified by the pragma, and then compiles only code that follows the pragma. If #pragma hdrstop does not specify a file name, the compiler looks for a file with a name derived from the base name of the source file with a .pch extension. You can also use the /Fp option to specify a different .pch file.
If you specify the /Yu option without a file name and fail to specify a hdrstop pragma, an error message is generated and the compilation is unsuccessful.
If the /Ycfilename and /Yufilename options occur on the same command line and both reference the same file name, /Ycfilename takes precedence, precompiling all code up to and including the named file. This feature simplifies the writing of makefiles.
Because .pch files contain information about the machine environment as well as memory address information about the program, you should only use a pch file on the machine where it was created.
For more information on precompiled headers, see:
To set this compiler option in the Visual Studio development environment
To set this compiler option programmatically