Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

488.h header file not compiling

I am trying to write a simple C++ console app. I include the ni488.h header and try to compile and get something like 80+ errors with the header file (see below), what am I doing wrong?
 
Compiler: Default compiler
Executing  g++.exe...
g++.exe "D:\Documents and Settings\e348953\Desktop\gpib.cpp" -o "D:\Documents and Settings\e348953\Desktop\gpib.exe"   -g3  -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include"  -I"C:\Dev-Cpp\include\c++\3.4.2\backward"  -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32"  -I"C:\Dev-Cpp\include\c++\3.4.2"  -I"C:\Dev-Cpp\include"   -L"C:\Dev-Cpp\lib" -g3
In file included from D:\Documents and Settings\e348953\Desktop\gpib.cpp:3:
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:259: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:259: error: ISO C++ forbids declaration of `parameter' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:276: error: `PCHAR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:276: error: ISO C++ forbids declaration of `LockShareName' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:277: error: `PWCHAR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:277: error: ISO C++ forbids declaration of `LockShareName' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:316: warning: `ibfindA' initialized and declared `extern'
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:316: warning: `__stdcall__' attribute only applies to function types
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:316: error: `LPCSTR' was not declared in this scope
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:317: error: `LPCSTR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:317: error: ISO C++ forbids declaration of `udname' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:318: error: `LPCSTR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:318: error: ISO C++ forbids declaration of `filename' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:319: error: `LPCSTR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:319: error: ISO C++ forbids declaration of `filename' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:321: warning: `ibfindW' initialized and declared `extern'
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:321: warning: `__stdcall__' attribute only applies to function types
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:321: error: `LPCWSTR' was not declared in this scope
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:322: error: `LPCWSTR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:322: error: ISO C++ forbids declaration of `udname' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:323: error: `LPCWSTR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:323: error: ISO C++ forbids declaration of `filename' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:324: error: `LPCWSTR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:324: error: ISO C++ forbids declaration of `filename' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:326: error: `PINT' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:326: error: ISO C++ forbids declaration of `v' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:329: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:329: error: ISO C++ forbids declaration of `buf' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:330: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:330: error: ISO C++ forbids declaration of `buf' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:333: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:333: error: ISO C++ forbids declaration of `buf' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:341: error: `PSHORT' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:341: error: ISO C++ forbids declaration of `result' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:342: error: `PSHORT' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:342: error: ISO C++ forbids declaration of `listen' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:344: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:344: error: ISO C++ forbids declaration of `RefData' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:350: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:350: error: ISO C++ forbids declaration of `buf' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:351: error: `PVOID' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:351: error: ISO C++ forbids declaration of `buf' with no type
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:352: error: `PCHAR' has not been declared
D:\Documents and Settings\e348953\Desktop\/ni488.hpp:352: error: ISO C++ forbids declaration of `ppr' with no type
 
 
Rest of list deprecated due to length!!
 
 
Thanks for any help!
James
0 Kudos
Message 1 of 10
(7,485 Views)
 

James,

Before the statement to include "ni488.h", you need to include the following line at the beginning of your application:

#include "windows.h"

#include "ni488.h"

There is a web page about how to use the Microsoft 32 bit Language Interface. It's a little out of date as it refers to the old header file, "decl-32.h", instead of the new one, "ni488.h", but the basic concepts are there.

Hope this information helps.

gpibtester

0 Kudos
Message 2 of 10
(7,456 Views)
Excellent! Thank you for the information, this will allow me to move ahead on my project now!
0 Kudos
Message 3 of 10
(7,450 Views)
 

James,

Glad that the information helped!

I just found out that the link in the previous post was bad. Here's the correct link to the Microsoft 32 bit Language Interface.

gpibtester

0 Kudos
Message 4 of 10
(7,440 Views)
Thank you for that. I was able to get the other mangled hyperlink to work too, just trimmed off the end bit of it. This does make it easier however.
0 Kudos
Message 5 of 10
(7,435 Views)

Can you provide any help on this one?


 


Compiler: Default compiler Building Makefile: "D:\Documents and Settings\e348953\Desktop\Makefile.win" Executing  make... make.exe -f "D:\Documents and Settings\e348953\Desktop\Makefile.win" all g++.exe main.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib" -lm "../../All Users/Documents/National Instruments/NI-488.2/Languages/Microsoft C/gpib-32.obj" 


Warning: .drectve `-defaultlib:uuid.lib ' unrecognized Warning: .drectve `-defaultlib:uuid.lib ' unrecognized


Execution terminated


 


Here is the main;


#include <cstdlib>

 #include <iostream>

 #include <windows.h>

 #include "ni488.hpp"


int main(int argc, char *argv[]) {

 system("PAUSE");

 int gpib;

gpib = ibfind("gpib0");

ibsic(gpib);

ibcmd(gpib,const_cast<char*>("_?@3"),4L;

ibwrt(gpib,const_cast<char*>("C2"),2L);

ibcmd(gpib,const_cast<char*>("_"),1L);

 return EXIT_SUCCESS;

 }

0 Kudos
Message 6 of 10
(7,409 Views)
Hello shard923,
I afraid the error you are seeing is a compiler error.

I have placed some links for you that points to some programming forums.
Please click here and here .

If you give us some more information about the specific compiler you are using, I may be able to help you further.
Let us know if this helps.

Christian A
National Instruments
Applications Engineer
0 Kudos
Message 7 of 10
(7,402 Views)

Christian,

 

I am using Dev C++ 4.9.9.2. I saw those posts you hyperlinked when I was searching myself, but everything I saw was a DirectX failure, which I didn't think applied here.

Thank you for the help!

0 Kudos
Message 8 of 10
(7,396 Views)

Hi Christian,

 

I have been searching quite a few forums to my problems and I have noticed that you are an avid helper in such areas so I was hoping you could assist me in finding the header file named ni-488.h header file that supposedly stores all the GPIB commands that I may use in my c++ program to control test equipments. The usual answer is that it is in the NI-488.2 file and then languages but I can't find this "languages" file.

 

I'm currently using windows 7 and I installed the GPIB driver just by connecting the GPIB-USB connector to my pc.

I'm using a free compiler IDE called Codeblocks.

 

Am I missing any other drivers because if I am, could you point me in the direction to my problem. Please do email me.

Any help would be greatly appreciated!

 

Regards,

dIn

wahidin88@gmail.com

0 Kudos
Message 9 of 10
(5,990 Views)

Hi,

 

If you installed the latest GPIB driver, NI-488.2 for Windows, by default it installs example files which are accessible from the Start->Programs menu. You will probably want to refer to the Direct Entry Examples to use with your particular C++ compiler.

 

Hope this information is helpful.

 

gpibtester

0 Kudos
Message 10 of 10
(5,968 Views)