The advisor-annotate.h header file includes windows.h to define some types and functions. As a result, in some cases including advisor-annotate.h may cause compilation errors. For example, the following conflict for the type
error C2371: ‘UINT' : redefinition; different basic types
To fix this problem, you can use a declaration/definition approach, where all uses of advisor-annotate.h other than one generate a set of declarations, and windows.h is only needed in a single implementation module. That is, you
ANNOTATE_DEFINE just before the
In nearly all modules that contain annotations, insert
#define ANNOTATE_DECLAREjust before
#include "advisor-annotate.h". This causes advisor-annotate.h to declare an external function, and not include windows.h, which avoids the type/symbol conflicts with windows.h.
In a single module that either does not include annotations or does not have type/symbol conflicts with windows.h, you insert
#define ANNOTATE_DEFINEjust before
#include "advisor-annotate.h". This causes advisor-annotate.h to define the global function to resolve the external reference and the
#include "advisor-annotate.h"is the only one that uses windows.h. These two lines can be placed in an otherwise empty .cpp file.
One way to do this is to add an empty .cpp to your project with two lines in it, shown as empty.cpp below.
//File foo.cpp/.h: ... // Insert #define ANNOTATE_DECLARE in all modules that contain annotations just before the // #include "advisor-annotate.h". This prevents inclusion of windows.h to avoid the // type/symbol conflicts. #define ANNOTATE_DECLARE #include "advisor-annotate.h" ... // annotation uses ANNOTATE_SITE_BEGIN(MySite1) ... ANNOTATE_SITE_END() ...
//File empty.cpp: // Insert #define ANNOTATE_DEFINE just before the #include "advisor-annotate.h" in only one module. // This single implementation file (.cpp/.cxx) causes windows.h to be included, and the support // routine is defined as a global routine called from the various annotation uses. #define ANNOTATE_DEFINE #include "advisor-annotate.h" ...
If the problem persists, please request support, such as by using the support forum. Use the link under See Also below to open the help topic Product Website and Support.