This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

linking problems


I'm getting the following error:

SomeDerivedClass.o: In function `CSomeDerivedClass::Initialize(CSomeDerivedClass const &)':
/usr/include/g++-2/stl_algobase.h:121: undefined reference to `CSomeDerivedClass::MemberFunction(void)'
collect2: ld returned 1 exit status
make: *** [simulator] Error 1

The MemberFunction() function is a virtual function with no arguments.
In the SomeDerivedClass.cpp file:

/////////////////////////////////////////////////////////////////////////////
// Function:    Initialize(const CSomeDerivedClass& a_rObjectToInitializeFrom)
// Arguements:  const CSomeDerivedClass& a_rObjectToInitializeFrom
// Return Type: Void.
// Description: Common initialization routine used by various constructors
//              and and the assignment operator.
// Revisions:   4/1/2000  -  Original creation.
/////////////////////////////////////////////////////////////////////////////
void CSomeDerivedClass::Initialize(const CSomeDerivedClass& a_rObjectToInitializeFrom)
{
	m_attribute1 = a_rObjectToInitializeFrom.m_attribute1;
	m_attribute2 = a_rObjectToInitializeFrom.attribute2;
	m_attribute3  = a_rObjectToInitializeFrom.m_attribute3;

}

The strange thing is this code had linked previously.  I've added new
code, but none relating to this function.  The objects compile with
no problems, but linking now fails.  I'm using egcs-2.91.66 on a Linux
system.  Thanks for any help.

Jiann-Ming Su, js1@microwave.ph.msstate.edu
Criminals, by definition, break the law...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]