LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I get the following errors with CVI 2010. "sal.h"(1706,15) Redefinition of macro '__null'.

A project which was working with CVI 9.0 on XP does not compile with CVI 2010.

 

 I get the following errors with CVI 2010. "sal.h"(1706,15)   Redefinition of macro '__null'.  

 

doesnt work with CVI 2010 on on win 7 too.  

Could some one provide some insight into this please?  

 

Thanks

performance

0 Kudos
Message 1 of 6
(4,297 Views)

I have found absolutely no documentation on these errors, which is highly unusual. Can you please provide a screenshot of this error as well as a description of what your program does? Does your program refer to or call any files that may have changed in the upgrade from XP to Windows 7? 

Regards,

Jackie

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 2 of 6
(4,268 Views)

Hi Jackie_B,

 win7 was an additional test i performed, but it doesnt compile with CVI 2010 on XP too.  The exact same machine and code base that i have been using for development with CVI 9.0 and prior versions.  I am pretty confident that the only variable is the new version of CVI.

 

incidentally that sal.h is an include file probably copied from the VC install directory.  and that file has not changed either.

 

One wild guess i have is that some standard include file provided by CVI might have changed to include some of these macros.. but i dont have an easy way to follow that up. 

 

Thanks

performance

0 Kudos
Message 3 of 6
(4,265 Views)

You wild guess is correct.

 

The version of the Microsoft SDK that shipped with CVI 9.0 included a definition of __null that matched the definition that is in sal.h. You can find this definition in line 448 of CVI90\sdk\include\specstrings.h.

 

The version of the Microsoft SDK that shipped with CVI 2010 included a definition of __null that no longer matches the definition that is in sal.h. You can find this definition in line 575 of CVI2010\sdk\include\spectstrings_strict.h. This is why the CVI compiler complains when it finds the sal.h definition.

 

The SDK that ships with CVI has been customized to make sure that it works with the CVI compiler. But this does not include making sure that it also works with VC headers. In general, there's no way to guarantee that VC headers can be compiled in CVI, since these headers don't ship with CVI and cannot be customized.

 

In this particular case, you might get it work if you include sal.h before you include windows.h. But there are no guarantees.

 

Luis

0 Kudos
Message 4 of 6
(4,244 Views)

hi Luis,  thanks for the confirmation.

 I was hoping that exporting the project to visual studio might avoid the CVI supplied files, but now i run into a whole bunch of other errors.

looks like there is no easy way out of this.

thanks

performance

 

0 Kudos
Message 5 of 6
(4,231 Views)

If the new errors you've run into are caused by swapping the order of the <windows.h> and <sal.h> inclusions, you might still be able to avoid them by leaving the order as you had it, and simply undefining the conflicting macros before you include sal.h. I'm attaching a header file containings these undef's of the conflicting symbols. All you would need to do would be to #include <undef.h> before including sal.h. It might be worth a try.

 

Luis

0 Kudos
Message 6 of 6
(4,218 Views)