Hi gcc experts,
I try to compile a sample .c file that communicates with the GPIB
interface (see attached c file) by using
GCC type of compilers, such as cygwin, Dev-Cpp, MinGW, and C-Free4. Then
I got the same sort
of error messages - the low level drivers were not found, see the log below:
gcc.exe "C:\Program Files\Agilent\IO Libraries
Suite\ProgrammingSamples\C\VISA\idn.c" -o "C:\Program Files\Agilent\IO
Libraries Suite\ProgrammingSamples\C\VISA\idn.exe" -ansi
-I"C:\Program Files\VXIPNP\WINNT\include" -L"C:\Program
Files\VXIPNP\WINNT\lib\msc"
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x59):idn.c:
undefined reference to `viOpenDefaultRM@4'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x86):idn.c:
undefined reference to `viOpen@20'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0x9c):idn.c:
undefined reference to `viPrintf'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xb9):idn.c:
undefined reference to `viScanf'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xda):idn.c:
undefined reference to `viClose@4'
C:\DOCUME~1\duanwang\LOCALS~1\Temp/ccOycaaa.o(.text+0xe8):idn.c:
undefined reference to `viClose@4'
collect2: ld returned 1 exit status
The low level drivers, such as viPrintf and viScanf are in the file of
visa32.lib that is seated in the directory of ...\lib\msc.
I mean the drivers are sit there but he compiler complains that the
drivers were not found. And the same error happens
either in windows application or in DOS window. Is there something
wrong? Please advise. What I expect is to produce
an .exe file that will talk to the instrument that is connected with the
pc with a GPIB interface.
Thanks,
Duan Wang
Alcatel-Lucent
978-952-7057
/*idn.c
This example program queries a GPIB device for an identification string
and prints the results. Note that you must change the address. */
#include <visa.h>
#include <stdio.h>
int main () {
ViSession defaultRM, vi;
char buf [256] = {0};
/* Open session to GPIB device at address 3 */
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM, "GPIB1::3::INSTR", VI_NULL,VI_NULL, &vi);
/* Initialize device */
/*viPrintf (vi, "*RST\n");*/
/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?\n");
/* Read results */
viScanf (vi, "%t", &buf);
/* Print results */
printf ("Instrument identification string: %s\n", buf);
/* Close session */
viClose (vi);
viClose (defaultRM);
}