Re: link error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Duan,

> Hi gcc experts,
Sorry, I'm not a gcc expert;-)
nevertheless:
>
> 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 linker complains, that in the files you are linken, the functions
viPrintf,... are used but never defined. 
> 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.
The Problem is: You have to tell the compiler to use the file
visa32.lib!
Try the additional parameter "-lvisa32" (telling gcc to link to a
library "visa32" - gcc will search in the Library-Directory which you
already specified). However, never having used gcc in Windows, I'm not
sure wheter gcc will recognize visa32.lib, when you link to visa32.

If not, try to give the complete Path to visa32.lib:
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"   C:\Program Files\VXIPNP\WINNT\lib\msc\visa32.lib

Then, gcc will pass visa32.lib to the linker and your errors should
disappear


HTH,

Axel

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux