다음을 통해 공유


Consistency Rules for /YX

OverviewHow Do ICompiler Options

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 preprocessor directives must match those specified when the PCH was created. These, along with #define directives, are checked as they appear during subsequent compilations that use the PCH. The #pragma directives must be nearly identical—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 the 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.