This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Creating dll in cygwin gives "Undefined reference" errors
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Sat, 28 Jul 2007 08:04:31 -0700
- Subject: Re: Creating dll in cygwin gives "Undefined reference" errors
- References: <5f0807670707280532t44a7d607vf92a06231313d5d9@mail.gmail.com> <5f0807670707280535u71d26ef6s4b0af545f30cd04f@mail.gmail.com>
- Reply-to: cygwin at cygwin dot com
Pradip Jadav wrote:
> But when I compiles in cygwin it gives me some "Undefined reference" errors.
> Take an example,
>
> /cygdrive/e/DOCUME~1/LOCALS~1/Temp/ccLMFYUe.o:sample.c:(.text+0x4c):
> undefined reference to `createlog(int, char*, ...)'
>
> Now this "createlog" function is defined in one of .cpp file of my
> main program.(Just for your information)
>
> Can you help me to solve problem of "undefined reference" ??
The undefined reference is because fundamentally ELF (Linux) and PE/COFF
(Windows) are very different in terms of how linking works under the
hood. The short explanation is that PE/COFF requires all references to
be resolved at link-time, thus you have to explicitly tell the linker
where createlog() is to be found.
But I've typed this explanation so many times, I think I'll just start
linking to past copies of it:
http://www.cygwin.com/ml/cygwin/2005-07/msg00675.html
http://www.cygwin.com/ml/cygwin/2006-12/msg00592.html
http://www.cygwin.com/ml/cygwin/2007-06/msg00450.html
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/