Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

niimaq.h compile error

I created a MSVC++ project, and inserted IMAQ ActiveX controls. I compiled and linked it and it runs fine. Now however, after including "niimaq.h", when i try to compile, the compiler throws the error, "error C2872: 'uInt32' : ambiguous symbol", on every line that a variable is declared as type uInt32.

If I copy the file into my project's directory and comment out the following lines,

typedef unsigned long uInt32;
typedef unsigned short uInt16;
typedef unsigned char uInt8;
typedef unsigned char uchar;

typedef long Int32;
typedef short Int16;
typedef char Int8;

it compiles. But I really don't want to copy that file and change it because I'll have problems when NI changes that file in the
future.

I've changed my link settings to include niimaq.lib and i've directed my includes to the proper directory. Does anyone know how to fix this?
0 Kudos
Message 1 of 3
(3,727 Views)
Which version of the driver are you using?? I am using the latest (NI-IMAQ 2.6) and do not see those lines in the "niimaq.h" file. You might just try downloading the latest version of NI-IMAQ and seeing if that solves the problem.
0 Kudos
Message 2 of 3
(3,727 Views)
What, in addition to niimaq.h, is defining uInt32 and the other data types? Are you using Measurement Studio C++ class libraries in this project?

If so, then you can fix this issue by removing "using namespace NI;" from the NiIncludes.h that Measurement Studio added to your project. You can then add "using namespace NI;" statements only in source files that use the Measurement Studio C++ class libraries and not the IMAQ C API. Alternatively, or if you need to use both APIs in the same source file, you can fully qualify the Measurement Studio C++ types (e.g. use NI::CNiReal64Vector instead of CNiReal64Vector).

The issue is that niimaq.h and CNiCommonComponent.h both define "uInt32". CNiCommonComponent.h actually defines "NI::uInt32", but the "using names
pace NI" statement causes the compiler to try to resolve usage of the symbol "uInt32" as both "::uInt32" and "NI::uInt32". Because both of these symbols exist, there is an ambiguity.

If you are not using Measurement Studio C++ components in your application, you will need to post back and let us know what other header file is defining uInt32 and the other ambiguous types.

David Rohacek
National Instruments
Message 3 of 3
(3,727 Views)