Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa.h error

I am using MS Visual C++ 6.0 to communicate with an instrument over a GPIB.

I added a  

#include <visa.h>

and im getting  fatal error C1080: cannot open include file:visa.h No such file or directory.

 

were do I go to get the necessary files to fix this error?

Thanks

0 Kudos
Message 1 of 15
(10,254 Views)

Have you tried a simple search of your hard drive?

 

On my XP system, the file is at C:\VXIPNP\WinNT\include.

0 Kudos
Message 2 of 15
(10,244 Views)
No i havent but i will try that now thanks.
0 Kudos
Message 3 of 15
(10,236 Views)
Check here C:\Program Files\IVI Foundation\VISA\<operating system>\include
0 Kudos
Message 4 of 15
(10,231 Views)
I will try that thank you.
0 Kudos
Message 5 of 15
(10,228 Views)
Did you manage to find it?
0 Kudos
Message 6 of 15
(10,198 Views)
I copied and pasted a program from a manual that should be working. I did what you said it took care of the Visa error but then i got an additional 7 errors.
0 Kudos
Message 7 of 15
(10,192 Views)
Can you give some description of the errors?
0 Kudos
Message 8 of 15
(10,190 Views)

Here is the program and errors

 

#include <stdio.h>
#include <memory.h>
#include <visa.h>

// This example opens a specific GPIB device, does an *idn query
// and prints the result.

int main(int argc, char* argv[])
{
 ViSession rm = VI_NULL, vi = VI_NULL;
 ViStatus status;
 ViChar  buffer[256];
 ViUInt32 retCnt;

 // Open a default Session
 status = viOpenDefaultRM(&rm);
 if (status < VI_SUCCESS) goto error;
 
 // Open the gpib device at primary address 1, gpib board 8
 status = viOpen(rm, "GPIB8::1::INSTR", VI_NULL, VI_NULL, &vi);
 if (status < VI_SUCCESS) goto error;

 // Send an ID query.
 status = viWrite(vi, (ViBuf) "*idn?", 5, &retCnt);
 if (status < VI_SUCCESS) goto error;

 // Clear the buffer and read the response
 memset(buffer, 0, sizeof(buffer));
 status = viRead(vi, (ViBuf) buffer, sizeof(buffer), &retCnt);
 if (status < VI_SUCCESS) goto error;

 // Print the response
 printf("id: %s\n", buffer);

 // Clean up
 viClose(vi); // Not needed, but makes things a bit more understandable
 viClose(rm);

 return 0;

error:
 // Report error and clean up
 viStatusDesc(vi, status, buffer);
 fprintf(stderr, "failure: %s\n", buffer);
 if (rm != VI_NULL) {
  viClose(rm);
 }
 return 1;
}

 

 Errors

 

 

 

imple.obj : error LNK2001: unresolved external symbol _viStatusDesc@12

Simple.obj : error LNK2001: unresolved external symbol _viClose@4

Simple.obj : error LNK2001: unresolved external symbol _viRead@16

Simple.obj : error LNK2001: unresolved external symbol _viWrite@16

Simple.obj : error LNK2001: unresolved external symbol _viOpen@20

Simple.obj : error LNK2001: unresolved external symbol _viOpenDefaultRM@4

Debug/JATO SIMPLE.exe : fatal error LNK1120: 6 unresolved externals

Error executing link.exe.

 

0 Kudos
Message 9 of 15
(10,176 Views)
Did you add the Visa32.lib to your project?
0 Kudos
Message 10 of 15
(10,172 Views)