04-01-2010 03:18 PM
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
04-01-2010 09:25 PM
Have you tried a simple search of your hard drive?
On my XP system, the file is at C:\VXIPNP\WinNT\include.
04-02-2010 05:18 AM
04-02-2010 07:50 AM
04-02-2010 08:07 AM
04-05-2010 01:22 AM
04-05-2010 04:56 AM
04-05-2010 04:59 AM
04-05-2010 05:24 AM
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.
04-05-2010 05:41 AM