From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22891 invoked by alias); 1 Apr 2009 13:42:28 -0000 Received: (qmail 22774 invoked by uid 22791); 1 Apr 2009 13:42:26 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.gmx.net (HELO mail.gmx.net) (213.165.64.20) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Wed, 01 Apr 2009 13:42:20 +0000 Received: (qmail invoked by alias); 01 Apr 2009 13:42:16 -0000 Received: from nano-66-21.grenoble.cnrs.fr (EHLO NANO-66-21.grenoble.cnrs.fr) [147.173.66.21] by mail.gmx.net (mp045) with SMTP; 01 Apr 2009 15:42:16 +0200 Date: Wed, 01 Apr 2009 13:42:00 -0000 From: Axel Freyn To: gcc-help@gcc.gnu.org Subject: Re: link error Message-ID: <20090401135054.GD22002@NANO-66-21.grenoble.cnrs.fr> Mail-Followup-To: gcc-help@gcc.gnu.org References: <49D36ABB.90507@alcatel-lucent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49D36ABB.90507@alcatel-lucent.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg00008.txt.bz2 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