Compilation Errors When Using Windows SDK Header Files on LabWindows™/CVI

Updated Dec 7, 2022

Reported In

Software

  • LabWindows/CVI

Issue Details

  • I am getting compiling errors on LabWindows™/CVI when referencing some specific header files such as winnt.h. The file is located in a Windows SDK folder.

  • I am getting the following error message when trying to compile my code on LabWindows™/CVI:
"winnt.h"(4327,78)   Redefinition of macro 'THREAD_BASE_PRIORITY_MIN'.
"winnt.h"(4328,76)   Redefinition of macro 'THREAD_BASE_PRIORITY_IDLE'.

Solution

LabWindows™/CVI compilation errors associated with SDK Header files can be caused due to conflict references between Windows SDK and LabWindows™/CVI libraries or incorrect paths that reference a different software file. 
 

You must include the Windows SDK include files before the LabWindows™/CVI include files (i.e. put #include <windows.h> before all other include files). This is needed because there are some functions from the native LabWindows™/CVI and the Windows SDK libraries that have the same name and cause errors between the calls. The LabWindows™/CVI include files contain special macros and conditional compilation to adjust for declarations in the SDK include files.
 

In order to verify that LabWindows™/CVI is not referencing a file from another compiler with the same name, select Options >> Environment >> Include Paths. If there is any path that is referenced incorrectly, click the Cut button to delete it.