This topic primarily applies to Windows systems. It is possible for similar errors to occur on Linux systems.
On Windows* systems, 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 UINT:
error C2371: ‘UINT' : redefinition; different basic types
On Linux systems, something similar could occur under certain very specific conditions when using a different header file for operating system threading software.
Possible Correction Strategies
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. In all cases, you #define either ANNOTATE_DECLARE or ANNOTATE_DEFINE just before the #include "advisor-annotate.h" as follows:
In nearly all modules that contain annotations, insert #define ANNOTATE_DECLARE just before #include "advisor-annotate.h". This causes advisor-annotate.h to declare an external function, and not include windows.h (or Linux equivalent), which avoids the type/symbol conflicts with the operating system threading header file, such as 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_DEFINE just 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 the operating system threading header file windows.h (or Linux equivalent). 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.
For example, on Windows systems:
//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 Product Website and Support.