LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI 6.0 can't seem in compile when I include windows.h

I am trying to compile my code which requires the header file windows.h. I just get errors in the basetsd.h and winnt.h headers like this:
"BASETSD.H"(165,26) Redeclaration of '__int64'.
"WINNT.H"(530,5) Undeclared identifier '__asm'.

just to show a few. I have used windows.h before in cvi 5.5 with no problems, however, I have not tried to compile this program with 5.5. Why might this be happening. Is my only solution to edit the header file and rem out the lines causing me problems???
0 Kudos
Message 1 of 4
(4,153 Views)
Hi,
I happend to have the same kind of problem once.
I don't know your project or how Include declaration is made... but for me it was directly coming from the "define", "ifdef" and "if notdef" stuffs you find in every .h.
The solution was to "play" with my many .h and simply change the order they were declared.
Hope it works for you..
Bye, Florent.
Message 2 of 4
(4,151 Views)
It is perfectly okay to edit these .h files if you do not need the typdefs that the compiler is complaining about. However, I suggest you do not overwrite the originals as you may need them for later projects.

If you are getting a compile error saying that there is a "redeclaration" of some type, it most likely means that another header file you are including also has the same typedef in it as well (the "undeclared" error obviously means that you are using an identifier that you have not defined anywhere previous to its use). Often times the redeclaration errors in CVI are caused by #including header files in an incorrect order. We have put many conditional definitions in our CVI specific header files that will not redefine identifiers found in the Windows
SDK headers so that they can both be used in the same modules, to avoid this you should put the unprotected SDK header file #include statements above all CVI specific header file #includes in your source files.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
Message 3 of 4
(4,151 Views)
I got a similar problem. It looks like followings:
 test.c - 10 errors
  "BASETSD.H"(157,17)  syntax error; found 'identifier' expecting ';'.
  "BASETSD.H"(165,26)  Redeclaration of '__int64'.
  "BASETSD.H"(165,26)  syntax error; found 'identifier' expecting ';'.
  "BASETSD.H"(166,26)  syntax error; found 'identifier' expecting ';'.
  "BASETSD.H"(167,26)  syntax error; found 'identifier' expecting ';'.
  "WINNT.H"(523,10)  syntax error; found 'identifier' expecting ';'.
  "WINNT.H"(530,5)   Undeclared identifier '__asm'.
  "WINNT.H"(530,14)  syntax error; found '{' expecting ';'.
  "WINNT.H"(531,9)   Undeclared identifier 'mov'.
  "WINNT.H"(531,17)  syntax error; found 'identifier' expecting ';'.
Any time I attach the inifile instrument driver in my project these errors appear. This also happen when I put #include <windows.h> on top of my .c file.
Actually in my project I wana write some strings into the ini file of my controller card (PMDi). But the Ini_PutString function of the inifile driver writes the unwanted double quotes into my ini file. So I have to modify the .c file of the driver (just change TRUE to FALSE in the Ini_Put function, i did't do anything with other things in the file).
In addition, the funny thing is that when I write a very simple programe, which has only 2 bottons, and attach the same modified driver, it work properly (with #include <windows.h>, meaning no error when compiling, and it writes the string into the ini file without the double quotes.
Can anyone please help me solve the problem.
Thanks a lot.
Best regards.
0 Kudos
Message 4 of 4
(3,996 Views)