05-07-2014 03:10 PM
Hello,
I have installed NI488.2 Version 3.1.2. I am using VC++ 10.0.
From the NI-VISA Manual, I have typed out the code below. When I compile it, I get this error: error LNK2019: unresolved external error symbol_viOpenDefaultRM@4 referenced in function_main. This only happens after I include the status = viOpenDefaultRM(&defaultRM); line. Does anyone know why this is? I am not sure which library I am missing or how I would link to it. However, I don't have any of the .obj or .lib files that I read on other forums. I am also using Windows X 32-bit.
#include <stdio.h>
#include <Windows.h>
#include "visa.h"
#define MAX_CNT 200
int main(void)
{
ViStatus status;
ViSession defaultRM, instr;
ViUInt32 retCount;
ViChar buffer[MAX_CNT];
status = viOpenDefaultRM(&defaultRM);
if (status <VI_SUCCESS){
return -1;
}
}
05-08-2014 11:37 AM
It looks like it's a problem with the way you're including visa.h. You'll probably want to reference the copy of visa.h where it was originally installed on your computer with VISA, so that the header file can access any resources it needs that it was installed with.
The best way would be to add its folder to your include path in your IDE, and then do:
include <visa.h>
the other way would be to explicitly use the long path to the original location of visa.h:
include "C:\...\visa.h" (where the "..." is replaced by the actual file path)