public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Axel Freyn <axel-freyn@gmx.de>
To: gcc-help@gcc.gnu.org
Subject: Re: link error
Date: Wed, 01 Apr 2009 13:42:00 -0000	[thread overview]
Message-ID: <20090401135054.GD22002@NANO-66-21.grenoble.cnrs.fr> (raw)
In-Reply-To: <49D36ABB.90507@alcatel-lucent.com>

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

  reply	other threads:[~2009-04-01 13:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-01 13:23 Duan Wang
2009-04-01 13:42 ` Axel Freyn [this message]
     [not found] <AANLkTiniPnQ-ioijpQXhMC1ygSqNSZsEGW2O-OVS5Qa8@mail.gmail.com>
2010-08-12 10:18 ` Link error Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2008-08-15 20:39 Vardhan, Sundara (GE Infra, Energy)
2008-07-24 21:03 Vardhan, Sundara (GE Infra, Energy)
2008-07-24 23:55 ` Rob Sherry
2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 11:41     ` Andrew Haley
2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 13:26         ` Andrew Haley
2008-07-29  8:56           ` Ralf Wildenhues
2008-07-29 11:49             ` Andrew Haley
2008-07-29 13:43               ` Vardhan, Sundara (GE Infra, Energy)
2008-07-24 10:04 Vardhan, Sundara (GE Infra, Energy)
2005-10-21 20:22 link error Moon Hwang
2005-10-21 23:08 ` Brian Dessent
2002-10-17  8:11 Link error HKOELMAN
2002-08-13  6:54 Link Error Tom Browder
2002-08-13  7:16 ` Ish Rattan
2002-08-13  7:30   ` Tom Browder
2002-08-13  7:59     ` Ish Rattan
2001-06-05 14:22 link error Alex Fridman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090401135054.GD22002@NANO-66-21.grenoble.cnrs.fr \
    --to=axel-freyn@gmx.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).