LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

compiler fails with errors in "winnt.h" from the CVI71/sdk/include directory. please help!

running CVI 7.1 on WinXP pro, and i seemed to have screwed something up, and im not sure how to fix it.

my program has been working just fine until now -- all of a sudden it fails to compile, with multiple errors    it claims to have a missing prototype for "stricmp", which i had been using all along without any problems until now

but there are also errors that occuring in several modules, all of them with the CVI71/sdk/include/winnt.h file... for these i get the exact same errors:


  "winnt.h"(219,21)   syntax error; found 'identifier' expecting ';'.
  "winnt.h"(225,15)   Redeclaration of 'WCHAR'.
  "winnt.h"(225,15)   syntax error; found '*' expecting ';'.
  "winnt.h"(225,15)   Unrecognized declaration.


which points to these lines:

218:  #ifndef _MAC
219:  typedef sdk_wchar_t WCHAR;    // wc,   16-bit UNICODE character     // CHANGED BY CVI
220:  #else
222:  typedef unsigned short WCHAR;    // wc,   16-bit UNICODE character
223:  #endif
225:  typedef WCHAR
*PWCHAR;

the problem started when I tried using the "errno" variable to track down library error strings.  attempting to use errno itself caused library errors, so i tried pointing to the errno.h include file in my Microsoft C++ include files.  I think this was my first mistake.   Now I am not sure how to undo it.

needless to say, this is a show-stopper.   any and all suggestions will be so appreciated.

thanks, robert



Message Edited by rjohnson on 12-06-2005 01:41 PM

0 Kudos
Message 1 of 8
(6,415 Views)
never mind.  i figured it out.

the answer is to remove my stupid include path to MS C++ via the Options>>Environment settings.  

the shorter and more concise answer is to RTFM.

...as usual.


0 Kudos
Message 2 of 8
(6,399 Views)
I'm having the same problem.  What did you do to fix it?
George Zou
0 Kudos
Message 3 of 8
(6,253 Views)

Hi zou,

Robert was pointing to a Visual C++ include directory.  To remove that directory, select Options >> Environment >> Include Paths, choose the appropriate path and then click the Cut button. 

Also note that 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 conflicts between the LabWindows/CVI libraries and the Windows SDK (some functions have the same names.).  The LabWindows/CVI include files contain special macros and conditional compilation to adjust for declarations in the SDK include files.

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 4 of 8
(6,235 Views)
Jonathan,
 
Thanks for reply.
 
I'm not pointing to any Visual C library, but pointing to a SDK crt library.  The header file is before NI headers.
The code can be downloaded from the following link:
 
George
 
George Zou
0 Kudos
Message 5 of 8
(6,225 Views)
Hi zou,
 
What do you mean you are pointing to a SDK crt library? Robert for example was pointing the C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt directory. The include paths are directories not actual libraries.  Remove whatever SDK crt path you have in the include paths dialog box.
 
If this doesn't make sense, post a screenshot of your include paths dialog box or post a small snippet of code.
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 6 of 8
(6,219 Views)
I'm pointing to the same dir.  It's needed, and add by CVI.  Without it, I got an error dialog window: "The include file "conio.h" was not found.  Do you want to look for it?"  If I choose "Yes", and browse to "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt", CVI add the path.
George Zou
0 Kudos
Message 7 of 8
(6,217 Views)

Hi zou,

LabWindows/CVI is an ANSI C compiler not a C++ compiler.  The conio.h header file is provided with Visual C++ not ANSI C.  You need to be trying to use LabWindows/CVI built in libraries. In this case instead of conio.h, you should be using the functions found in the stdio.h header file. 

The directory you are pointing to contains header files that are causing conflicts with our SDK header files (i.e. winnt.h). One alternative (that may or may not work depending on how the header files are defined --- i.e. for C compilers you need extern "C" statements), you could try including the individual header file in the LabWindows/CVI project. Then reference the header file by saying #include "conio.h".  Do this instead of including a path to that directory. 

Again, you are trying to use non-ANSI C header files so its recommended that you try and use the header files that are installed with LabWindows/CVI.

Best Regards,

Jonathan N.
National Instruments
Message 8 of 8
(6,211 Views)