Undefined Reference Error while linking with g++, STL on LINUX

R

RU

Hi,

I am working on a porting project to port C/C++ application from
unixware C++, AT&T Standard components to g++ with STL on Linux. This
application has been working properly on Unixware/C++/AT&T componets
environment.

I have been able to compile all modules after making necessary changes
in LINUX/gcc/STL environment. We have two templates defined XList and
XMap.

I am getting following errors when I try to link all the modules. All
errors are related to templates XList and XMap.

/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::~XNVAMsgRcv [not-in-charge]()':
xnvamsgrcv.o(.text+0xfb): undefined reference to `XMap<unsigned short,
XNVAMsgValue*>::~XMap [in-charge]()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::~XNVAMsgRcv [in-charge]()':
xnvamsgrcv.o(.text+0x16f): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::~XMap [in-charge]()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::~XNVAMsgRcv [in-charge deleting]()':
xnvamsgrcv.o(.text+0x1e3): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::~XMap [in-charge]()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::MorphBequeath(XNVAMsgRcv*)':
xnvamsgrcv.o(.text+0x258): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::Iterate()'
xnvamsgrcv.o(.text+0x285): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::GetNext(unsigned short&, XNVAMsgValue*&)'
xnvamsgrcv.o(.text+0x2a7): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::SetAt(unsigned short const&, XNVAMsgValue*)'
xnvamsgrcv.o(.text+0x2ec): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::RemoveAll()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::DispatchPayload(unsigned char const*, unsigned char,
unsigned short, unsigned long, unsigned long, unsigned long&)':
xnvamsgrcv.o(.text+0x8b5): undefined reference to
`XList<XNVAMsgRcv*>::IsEmpty() const'
xnvamsgrcv.o(.text+0x8f5): undefined reference to
`XList<XNVAMsgRcv*>::GetTail() const'
xnvamsgrcv.o(.text+0x94f): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::Lookup(unsigned short const&, XNVAMsgValue*&)
const'
xnvamsgrcv.o(.text+0x9b8): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::SetAt(unsigned short const&, XNVAMsgValue*)'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::CleanupMap()':
xnvamsgrcv.o(.text+0x9e2): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::Iterate()'
xnvamsgrcv.o(.text+0xa0b): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::GetNext(unsigned short&, XNVAMsgValue*&)'
xnvamsgrcv.o(.text+0xa46): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::RemoveAll()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::IterateValues()':
xnvamsgrcv.o(.text+0xa5c): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::Iterate()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::GetNextValue(unsigned char&, unsigned short&)':
xnvamsgrcv.o(.text+0xa87): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::GetNext(unsigned short&, XNVAMsgValue*&)'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function
`XNVAMsgRcv::HasValue(unsigned short) const':
xnvamsgrcv.o(.text+0xaea): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>::Lookup(unsigned short const&, XNVAMsgValue*&)
const'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvamsgrcv.o): In function

I appreciate all help on this problem.

Thanks,
Raghu
 
V

Victor Bazarov

RU said:
I am working on a porting project to port C/C++ application from
unixware C++, AT&T Standard components to g++ with STL on Linux. This
application has been working properly on Unixware/C++/AT&T componets
environment.

I have been able to compile all modules after making necessary changes
in LINUX/gcc/STL environment. We have two templates defined XList and
XMap.

I am getting following errors when I try to link all the modules. All
errors are related to templates XList and XMap.
[...]

Try putting the implementation of those functions in the header.
 
R

RU

This is my setup:
1)Library Setup:
1.1) lib1.cpp and lib1.hpp has class definition and declaration of
class CString
1.2) lib2.cpp and lib2.hpp has class definition and declaration of a
template class XMap that uses map template class provided by STL.

2)Application Setup:
2.1) mod1.cpp and mod1.hpp has class definition and declaration
required for application. In this module, we are defining another
class
CHeader, and later on, define an object XMap<CString,CHeader*>. XMap
is defined in lib2, CString is defined in lib1 and CHeader is
defined in mod1.
2.2) main.c invokes methods in mod1.

All four modules compile without error. When linking, I am getting
undefined error on XMap<CString,CHeader*>.

We are trying to port UNIXWARE C++ AT&T component application to LINUX
g++3.2.2 STL environment.

I appreciate all help in this matter.

I can not instantiate XMap<CString,CHeader*> in lib2, because CHeader
is defined in the application.

RU

Victor Bazarov said:
RU said:
I am working on a porting project to port C/C++ application from
unixware C++, AT&T Standard components to g++ with STL on Linux. This
application has been working properly on Unixware/C++/AT&T componets
environment.

I have been able to compile all modules after making necessary changes
in LINUX/gcc/STL environment. We have two templates defined XList and
XMap.

I am getting following errors when I try to link all the modules. All
errors are related to templates XList and XMap.
[...]

Try putting the implementation of those functions in the header.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top