This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Unresolved references to opendir/readdir/closedir


 Just guessing.
 You want to use 'opendir'.
 You need a prototype.
  grep opendir /usr/include/*.h
       Nope, not there.
  grep opendir /usr/include/sys/*.h
       OK, it's in /usr/include/sys/dirent.h
  great, let's try
      #include <sys/dirent.h>

   WRONG!
    For C++, you need the
#ifdef __cplusplus
extern "C" {
...
    that's in /usr/include/dirent.h

Recompile SVIntfLoader using the correct include file.

> -----Original Message-----
> From: Lyman Neuschaefer [mailto:lyman@bcsisims.com]
> Sent: Monday, March 05, 2001 4:45 PM
> To: cygwin@cygwin.com
> Subject: RE: Unresolved references to opendir/readdir/closedir
> 
> 
> 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.
> 
> Lyman
> 
> -----Original Message-----
> From: Christopher Faylor [mailto:cgf@redhat.com]
> Sent: Monday, March 05, 2001 1:58 PM
> To: cygwin@cygwin.com
> Cc: lyman@bcsisims.com
> Subject: Re: Unresolved references to opendir/readdir/closedir
> 
> 
> On Mon, Mar 05, 2001 at 01:59:44PM -0700, Lyman Neuschaefer wrote:
> >Apologies in advance for the following inane question:
> >
> >I am unable to link an executable which uses opendir, readdir
> >and closedir.  Via nm I am unable to find definitions for
> >these symbols in any of the libraries in /usr/lib.  Moreover,
> >I've scoured the cygwin FAQ as well as the cygwin archive
> >and have found no answer to this problem.  Surely I'm not
> >understanding something fundamental.
> 
> You apparently don't have the cygwin package fully installed.
> Rerun setup and install it.
> 
> cgf
> 
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
> 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]