delorie.com/archives/browse.cgi | search |
Date: | Fri, 23 Mar 2001 13:00:41 +0200 |
From: | "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> |
Sender: | halo1 AT zahav DOT net DOT il |
To: | djgpp AT delorie DOT com |
Message-Id: | <9003-Fri23Mar2001130041+0200-eliz@is.elta.co.il> |
X-Mailer: | Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 |
In-reply-to: | <3ABA3BD8.9ECC1B29@nowhere.com> (message from Simon Wood on Thu, |
22 Mar 2001 17:52:24 +0000) | |
Subject: | Re: help - collect2.exe not linking element from a library |
References: | <3ABA3BD8 DOT 9ECC1B29 AT nowhere DOT com> |
Reply-To: | djgpp AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
> From: Simon Wood <simon AT nowhere DOT com> > Newsgroups: comp.os.msdos.djgpp > Date: Thu, 22 Mar 2001 17:52:24 +0000 > > Thes following describes a problem I am seeing with collect2.exe > apparently not picking up the fact that a module exists within a > library. collect2 doesn't search the libraries at all. It's the linker that you have a problem with. > In the linking process DJGPP runs: > c:/djgpp/lib/gcc-lib/djgpp/2.952/collect2.exe -o mdemo > c:/djgpp/lib/crt0.o -Lc:/soft/dev/microwin/src/lib -Lc:/djgpp/lib > -Lc:/djgpp/lib/gcc-lib/djgpp/2.952 -Lc:/djgpp/bin -Lc:/djgpp/lib -lgrx20 > mdemo.o c:/soft/dev/microwin/src/lib/libmwin.a > c:/soft/dev/microwin/src/lib/libmwinlib.a > c:/soft/dev/microwin/src/lib/libmwengine.a > c:/soft/dev/microwin/src/lib/libmwdrivers.a > c:/soft/dev/microwin/src/lib/libmwfonts.a > c:/soft/dev/microwin/src/lib/libmwimages.a -lgrx20 -lgcc -lc -lgcc > -Tdjgpp.djl c:/soft/dev/microwin/src/lib/libmwinlib.a > > and gives: > (edit.o)(.text+0x6f6):edit.c: undefined reference to `CreateFont' > > 'CreateFont' is in winfont.o, which is in libmwin.a. [snip] > edit.o is in libmwinlib.a > > If I suffix the (long) command with > 'c:/soft/dev/microwin/src/mwin/winfont.o' (to specify another object to > add) then it builds and runs.... very strange!! You forgot that ld.exe is a one-pass linker: it only scans the libraries once, in the order you specify them in the link command line. Thus, by the time it sees a reference to CreateFont in libmwinlib.a, it has already scanned libmwin.a, and it isn't going to scan it again. A solution is to append a second instance of c:/soft/dev/microwin/src/lib/libmwin.a to the end of your link command line. See section 8.10 of the DJGPP FAQ list for more about this and alternative solutions.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |