problem linking with cygwin

Suhaib M. Siddiqi
Tue May 11 14:57:00 GMT 1999

> I have some internal unix libs I am trying to compile using cygwin
> and get the following errors when linking:
> when I simply compile with no -l, I get:
> GEN_Hash.o(.text+0x14):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0xb2):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x580):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x5c3):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x690):GEN_Hash.c: undefined reference to `memalign'
> GEN_Hash.o(.text+0x77e):GEN_Hash.c: more undefined references to `memalign' follow
> collect2: ld returned 1 exit status

Sounds like you have libraries which do  not provide symbols you need.  You need
another library? to resolve it?

> so then when I use the -lc compiler switch I get:
> C:\cygnus\CYGWIN~1\H-I586~1\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\..\..\..\..\i586-cygwin32\lib/libcygwin.a(libccrt0.o)(.data+0x0) multiple definition of `_impure_ptr'
> C:\cygnus\CYGWIN~1\H-I586~1\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\..\..\..\..\i586-cygwin32\lib/libc.a(impure.o)(.data+0x2ec):impure.c: first defined here
> collect2: ld returned 1 exit status

You do not need to add -lc.  libcygwin.a which links autmatically takes care of it.

Try including errno.h, that usually take take care of impure_ptr ( at least in my hands)

> Apologies if I am missing something very basic here.
> Rgds,
> Rand Dvorak
> This message contains confidential information and is intended only 
> for the individual named.  If you are not the named addressee you 
> should not disseminate, distribute or copy this e-mail.  Please 
> notify the sender immediately by e-mail if you have received this 
> e-mail by mistake and delete this e-mail from your system.
> E-mail transmission cannot be guaranteed to be secure or error-free 
> as information could be intercepted, corrupted, lost, destroyed, 
> arrive late or incomplete, or contain viruses.  The sender therefore 
> does not accept liability for any errors or omissions in the contents 
> of this message which arise as a result of e-mail transmission.  If 
> verification is required please request a hard-copy version.  This 
> message is provided for informational purposes and should not be 
> construed as a solicitation or offer to buy or sell any securities or 
> related financial instruments.
> --
> Want to unsubscribe from this list?
> Send a message to

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list