Diagnostic 673: the initial sequence of preprocessing directives is not compatible with those of precompiled header file

Cause:

Consider the two source files below:

a.cpp:
  # include "a.h"
 // code

b.cpp:
  # include "b.h"
  # include "a.h"
 // code

If you compile both of these files with /Yua.h, then the include directives do not get processed. Instead, a.pch[i] is read into memory, and compilation immediately starts with the code. If a.pch was created from a compilation of a.cpp, then the compilation of a.cpp works just the way it should. But when you try to compile b.cpp, you do not have any of the declarations from b.h. If the code in b.cpp actually tries to use any declaration from b.h, there will probably be an error. On the other hand, if a.pch was created from a compilation of b.cpp, then a.cpp will have access to declarations from b.h even though, according to the source, it should not. This is less likely to cause compilation errors, but you can still run into problems because overload resolution may happen differently.

Warning  # 673 is letting the user know that a PCH file is being used, even though the compiler can tell that the results of compilation may not exactly  match the results of compiling without PCH.  For example:

// Create precompiled header through a.cpp
>icl -c /Yca.h a.cpp
Intel® C++ Compiler Professional for applications running on IA-32, Version 11.0    Build 20090131 Package ID: w_cproc_p_11.0.072
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

a.cpp

>icl -c /Yua.h a.cpp
Intel® C++ Compiler Professional for applications running on IA-32, Version 11.0    Build 20090131 Package ID: w_cproc_p_11.0.072
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

a.cpp

>icl -c /Yua.h b.cpp
Intel® C++ Compiler Professional for applications running on IA-32, Version 11.0    Build 20090131 Package ID: w_cproc_p_11.0.072
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

b.cpp
Warning #673: the initial sequence of preprocessing directives is not compatible with those of precompiled header file "a.pchi"

Resoluton:

You can work around the warning by not using PCH, which may not be an attractive option, or by changing the sources to make all source files which use a given PCH file consistent through the PCH stop point (usually the include directive for the file mentioned in the /Yu option). This consistency refers only to preprocessing directives; comments and other white space do not count.

 

Einzelheiten zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.