delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/05/17:03:04

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 5 Mar 2001 16:54:57 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Cc: lyman AT bcsisims DOT com
Subject: Re: Unresolved references to opendir/readdir/closedir
Message-ID: <20010305165457.A18597@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com, lyman AT bcsisims DOT com
References: <20010305155758 DOT D16971 AT redhat DOT com> <NDBBIAKKHKMFGDHKLMKPGENFCBAA DOT lyman AT bcsisims DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <NDBBIAKKHKMFGDHKLMKPGENFCBAA.lyman@bcsisims.com>; from lyman@bcsisims.com on Mon, Mar 05, 2001 at 02:44:46PM -0700

On Mon, Mar 05, 2001 at 02:44:46PM -0700, Lyman Neuschaefer wrote:
>Further elaboration on my problem,
>
>Thanks for your reply.  I've tried what you said, but
>am still having problems...
>
>After reinstalling cygwin 1.1.8 on
>Win NT SP5 I have found definitions
>for opendir/readdir/closedir within /lib/libc.a:
>
> /lib:54>nm -C libc.a |egrep '(opendir|readdir|closedir)'
> 00000000 I _imp__readdir
> 00000000 T readdir
> 00000000 I _imp__opendir
> 00000000 T opendir
> 00000000 I _imp__closedir
> 00000000 T closedir
> 00000000 I _imp___readdir
> 00000000 T _readdir
> 00000000 I _imp___opendir
> 00000000 T _opendir
> 00000000 T _closedir
> 00000000 I _imp___closedir
>
>However, these symbols are still unresolved when linking
>an executable as observed below:
>
> g++  -o svintf SVIntf.o cnf.a \
> ../message/message.a \
> ../viewers/table.a \
> ../common/common.a \
> ../../../tools/bcgui/bcgui.a \
> ../../../tools/support/support.a \
> -L/usr/local/LessTif/Motif2.0/lib -L/usr/X11R6/lib -L/lib -lc -lXm -lXt -lS
>M -lICE -lX11
> cnf.a(SVIntfLoader.o)(.text+0x2942):SVIntfLoader.C: undefined reference to
>`opendir(char const *)'
> cnf.a(SVIntfLoader.o)(.text+0x2a7b):SVIntfLoader.C: undefined reference to
>`readdir(DIR *)'
> cnf.a(SVIntfLoader.o)(.text+0x2c43):SVIntfLoader.C: undefined reference to
>`closedir(DIR *)'
> cnf.a(SVIntfLoader.o)(.text+0x2ce4):SVIntfLoader.C: undefined reference to
>`opendir(char const *)'
> cnf.a(SVIntfLoader.o)(.text+0x2e3b):SVIntfLoader.C: undefined reference to
>`readdir(DIR *)'
> cnf.a(SVIntfLoader.o)(.text+0x3107):SVIntfLoader.C: undefined reference to
>`closedir(DIR *)'
> collect2: ld returned 1 exit status
>
>Notice the explicit inclusion of /lib/libc.a (-L/lib -lc).  I am tearing my
>hair out on this one.  Thanks for any help you can provide.

1) Don't explicitly include -lc.  There is no reason to do this and it could
   conceivably cause problems.

2) Do explicitly include the include file where these functions are
   declared.  As you can see from the 'nm' above, imported versions of
   functions are referenced by prepending __imp_ to the function names.
   Unless you declare the functions correctly, your program won't properly
   link these.  If you don't know, use grep to find the header file
   where the functions are declared.

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019