By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"RU" <ru****@easylink.com> wrote...
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.
Jul 19 '05 #2

P: n/a
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" <v.********@attAbi.com> wrote in message news:<vi************@corp.supernews.com>...
"RU" <ru****@easylink.com> wrote...
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.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.