help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bizarre linkage problem involving archives


From: Jo
Subject: Bizarre linkage problem involving archives
Date: 10 May 2004 12:52:00 -0700

For some reason if I try to link a particular object with a particular
archive, certain symbols go "undefined", while if I link with the only
object in the archive, the link succeeds. What it seems to come down
to, is that an archive isn't just as good as the objects it contains.
The call goes something like this:

g++ ... -o executable ../mysql_support/libMySQLsupport.a
../common/libcommon.a

>From this I get a list of:

../mysql_support/libMySQLsupport.a(_sqlsession.o)(.text+0x1f6): In
function `_SQLSession::Open(char const*)':
/home/angus/work_stuff/zedmonitor/mysql_support/_sqlsession.cpp:27:
undefined reference to `g_Log'

Now, if I put:

g++ ... -o executable ../mysql_support/libMySQLsupport.a
../common/parameters_project.o

which should be the same thing, everything links fine. The content of
ar t ../common/libcommon.a is:

parameters_project.o

So shouldn't ../common/libcommon.a be just as good
../common/parameters_project.o?

parameters_project.h has extern Log g_Log; and parameters_project.cpp
has Log g_Log; which is what I expected to be defined in
parameters_project.o. Other symbols referenced in _SQLSession (and
defined in other archives) link fine, and I have other targets in this
project that link with g_Log without incident. So why is this single
object unable to link with another single object iff that 2nd object
is in an archive?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]