Unsatisfied Link Error when compiling with g++ 3.2.3
From:
Leonard Wesley
Subject:
Unsatisfied Link Error when compiling with g++ 3.2.3
Date:
Mon, 04 Jul 2005 20:15:28 -0700
After compiling the following code fragment into a .so file
using GNU g++ 3.2.3 I get an "unresolved reference" error
message when that .so file is loaded. I do not get this error
with earlier versions (e.g., 2.9.x) of the GNU g++ compiler.
Assume Name, DiscreteProposition, ContinuousProposition,
constructors, destructors, comparitors, n, and ctp have been
properly defined and initialized.
template<class FrameType =
DiscreteProposition>
class Frame
{
public: //
Constructors Frame();
Frame(const Name &);
Frame(const Name &, const FrameType &); //
Destructor ~Frame();
//
comparitors bool
operator==(Frame &); bool
operator!=(Frame &); // copy
Frame
& operator=(const Frame &); : :
} :
map<Name, Frame<ContinuousProposition>, less<Name> >
ContinuousFrameMapping; :
ContinuousProposition ctp;
Name n; :
Frame<ContinuousProposition> Fx (n, ctp); :
Name tag = "abc";
ContinuousFrameMapping[tag] = Fx;
The above code is compiled into a <file
name>.so file that is part of C++
and JNI code to interface Java with native C++ code.
While Java is loading the <file name>.so file at
runtime, the following error message
is displayed.
The unresolved link error error seems to be related to a
constructor/destructor that
is needed as a result of the
ContinuousFrameMapping[tag] = Fx;
statement.
However, I cannot figure out what needs to be defined to fix this error.
Any suggestions?