This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Consistency Rules for /YX
If a precompiled header file exists (either MSVC.pch or one specified by /Fp), it is compared with the current compilation for consistency. The following requirements must be met; otherwise, a new precompiled header file is created, and the new file replaces the old.
- The current compiler options must match those specified when the precompiled header was created. However, if a significant portion of the source code of the currently compiled module matches the module for which the PCH was created, the compiler can create a new PCH for the matching part. This subsetting action increases the number of modules for which a PCH can be used.
- The current working directory must match that specified when the PCH was created.
- The order and values of all #include and #pragma directives must match those specified when the precompiled header was created. These, along with #define directives, are checked one by one as they appear during subsequent compilations that use the precompiled header. The values of #define directives must match. However, a sequence of #define directives need not occur in exactly the same order because there are no semantic order dependencies for #define directives. The #pragma directives must be nearly identical, with a few exceptions; for example, multiple spaces outside of strings are treated as a single space to allow for different programming styles.
- The values of #define directives must match. However, a group of #define directives in sequence need not occur in exactly the same order since there are no semantic order dependencies for #define directives.
- The value and order of include paths specified on the command line with /I (Additional Include Directories) options must match those specified when the precompiled header was created.
- The timestamps of all header files (all files specified with #include directives) used to build the precompiled header must match those that existed when the precompiled header was created.
See Also
/YX (Automatic Use of Precompiled Headers) | Compiler Options | Setting Compiler Options