This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/26699] LD doesn't link in an object from an archive when the object has only public variables
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Mar 2006 16:17:00 -0000
- Subject: [Bug other/26699] LD doesn't link in an object from an archive when the object has only public variables
- References: <bug-26699-12366@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-03-15 16:16 -------
First this is not a bug.
Lets look at your link line:
cc -o main -L. -ldata main.o
What is saying to the linker is look at libdata first for symbols that are
required already and then look at main.o. Since main.o has a reference to
libdata, this fails as the linker are one pass linkers when looking for
symbols. Change the order of the link line and it will work.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c |other
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26699