LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ObjIdl.h errors

Solved!
Go to solution

We are finally going to upgrade our Labwindows from 2008 to 2012. I knew that I would have some dificulties and I certainly am.

When building the project every file is flagging many errors pertaining to the ObjIdl.h file.

 

The errors are many but the 1st one flags this line:

/* [size_is][in] */ __RPC__in_xcount_full (csent) BYTE *buf

Error is:

Missing parameter type (__RPC_in_xcount_full)

Expecting an identifier

 

Many, many others in the ObjIdl.h file are failing for the same reason.

 

I have Microsoft DirectX SDK (February 2007) loaded.

I tried the latest Microsoft Direct SDK (2010). It did not flag any of the above errors but it was failing trying to find a file called SAL.H which is nowhere to be found, so I went back to the SDK I had when using labwindows 2008, THe February 2007 SDK did not reference SAL.H. The new 2010 dsound.h file needs the SAL.H but the 2007 dsound.h does not. So confusing.

 

I hope this is enough information for someone to help me. This is an area where I have no clue what's going on and I really don't want to know.

 

Thanks

John

 

 

0 Kudos
Message 1 of 24
(7,062 Views)

I decided to just stick with the Microsoft Direct SDK (2010) and try to figure out what's going on.

When I build my project the following error is being generated:

Within the include file dsound.h, the include file sal.h cannot be found. It is nowhere in the Microsoft Direct SDK (2010) folder.

I looked up on the internet and a few topics say that sal.h resides in:

"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" (VS 2008) or

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" (VS 2010)

 

Does this mean I need Visual studio on my laptop top be able to use the Microsoft Direct SDK (2010) in Labwindows?

 

Thanks

John W.

 

 

0 Kudos
Message 2 of 24
(7,040 Views)

Hello John,

The DirectX SDK is just a group of libraries with the headers that you are looking for.

You can download the API here and place it anywhere you want on your computer. Visual Studio probably installs it as a default library since it is all Microsoft's software.

 

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 3 of 24
(7,031 Views)

Thanks for the reply.

 

I do have the Microsoft DirectX SDK 2010 loaded on my PC.

But there is an include file in Microsoft DirectX SDK 2010 called dsound.h that my application is using and in dsound.h, it is looking for a file called sal.h. sal.h is not in the Microsoft DirectX SDK 2010 folder.

What do I need to do?

 

Thanks!

John W.

 

0 Kudos
Message 4 of 24
(7,021 Views)

That seems pretty odd. How about simply copying that file into a folder with the path name it is looking for.

On my machine the file also lives in the following folder: C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src

 

You could also consider installing the required version of Microsoft Visual Studio Redistributable Package which may install the components you require.

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 5 of 24
(7,014 Views)

I loaded Visual Studio 10.0 onto my laptop.

I verified that sal.h resides in c:\Program Files(x86)\Microsoft Visual Studio10.0\VC\include

In my Labwindows project I setup the path to this directory in the Environment setup.

Now when I build my project each of my C files is flagging an error in the sal.h file

All the errors are Redefinition of macros such as:

Test.c - 19 errors

  sal,h Redefinition of macro '__null'

  sal.h Redefinition of macros '__notnull'

  sal.h Redefinition of macros '__maybenull'

  sal.h Redefinition of macros '__readable To'

  and many many more

 

I have no clue what to do next. If anyone can help, please respond.

 

Thanks!

John W.

 

0 Kudos
Message 6 of 24
(6,965 Views)

The version of the Microsoft SDK that shipped with CVI 2012 includes definitions that do not match the definitions inside the Visual Studio folder in which you found sal.h.  This is why LabWindows/CVI is complaining that the macros are being redefined.  

 

You may want to try undefining the macros in question before calling sal.h.  An example of the syntax for performing this undefine for __null is the following:

#undef __null

 

If you properly undefine these macros before calling sal.h, CVI should adopt the definition of these macros from sal.h.

Daniel Dorroh
National Instruments
0 Kudos
Message 7 of 24
(6,948 Views)

Thanks for the reply.

 

I still do not know what to do. What file or files do I undefine the definitions?

 

 

Thanks!

John W.

 

0 Kudos
Message 8 of 24
(6,935 Views)

Hi John,

 

The error is happening because you are including header files with conflicting definitions for the macros which are listed in the error.  

 

You mentioned the errors:


  sal.h Redefinition of macro '__null'

  sal.h Redefinition of macros '__notnull'

  sal.h Redefinition of macros '__maybenull'

  sal.h Redefinition of macros '__readable To' 


The syntax which causes the error may look like the following:

#include <windows.h>  //contains definitions of macros such as __null.  This header exists in the CVI directory.

#include <dsound.h>  //contains the header sal.h which has conflicting definitions for macros such as __null.  This header exists in the Windows SDK directory.

 

In order to eliminate the conflicts, i.e. "sal,h Redefinition of macro '__null,'"  you will need to do one of the following:

 

1. Modify sal.h for use in your code.

1.  Open sal.h

2.  Save a copy as sal.h in a different location.

3.  Eliminate the macro definitions, which cause the conflicts, from the copied file.

4.  Point dsound.h to the copied sal.h file, instead of the sal.h file located in the Microsoft SDK directory.


2. Write a header file which removes the conflicting definitions before dsound.h is called.

1.  Create a new header file.

2.  Undefine the conflicting macros.  (#undef __null for example for undefining the __null macro)

3.  Call this header file right before dsound.h 

 

This should remove those exceptions.

 

A good resource about the C preprocessor can be found here.  Please refer to the subsection "Redefining Macros" for information on the error you are encountering.

 

I found another thread which may be of use as well: http://forums.ni.com/t5/LabWindows-CVI/I-get-the-following-errors-with-CVI-2010-quot-sal-h-quot-1706...

 

Please try the above fixes, and let us know if you encounter any more questions.

 

Regards,

Daniel Dorroh
National Instruments
Message 9 of 24
(6,916 Views)

I created a new sal.h and eliminated all the redefinition macros and that worked.

But know I have a whole new batch of errors.

My Test.c file flags the following errors (many many more than these)

crtdefs.h  (402,23) Invalid use of 'Int'

crtdef.h   (546,21) Expecting ")"

crtdefs.h  (550,127) Missing parameter type

Many more files (ex. ctype.h, WinNT.h, etc, etc)

 

I am just overwelmed, need some guidance!

 

Thanks

John W.

 

 

0 Kudos
Message 10 of 24
(6,871 Views)