473,738 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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(xnvam sgrcv.o): In function
`XNVAMsgRcv::~X NVAMsgRcv [not-in-charge]()':
xnvamsgrcv.o(.t ext+0xfb): undefined reference to `XMap<unsigned short,
XNVAMsgValue*>: :~XMap [in-charge]()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::~X NVAMsgRcv [in-charge]()':
xnvamsgrcv.o(.t ext+0x16f): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :~XMap [in-charge]()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::~X NVAMsgRcv [in-charge deleting]()':
xnvamsgrcv.o(.t ext+0x1e3): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :~XMap [in-charge]()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::Mo rphBequeath(XNV AMsgRcv*)':
xnvamsgrcv.o(.t ext+0x258): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :Iterate()'
xnvamsgrcv.o(.t ext+0x285): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :GetNext(unsign ed short&, XNVAMsgValue*&) '
xnvamsgrcv.o(.t ext+0x2a7): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :SetAt(unsigned short const&, XNVAMsgValue*)'
xnvamsgrcv.o(.t ext+0x2ec): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :RemoveAll()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::Di spatchPayload(u nsigned char const*, unsigned char,
unsigned short, unsigned long, unsigned long, unsigned long&)':
xnvamsgrcv.o(.t ext+0x8b5): undefined reference to
`XList<XNVAMsgR cv*>::IsEmpty() const'
xnvamsgrcv.o(.t ext+0x8f5): undefined reference to
`XList<XNVAMsgR cv*>::GetTail() const'
xnvamsgrcv.o(.t ext+0x94f): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :Lookup(unsigne d short const&, XNVAMsgValue*&)
const'
xnvamsgrcv.o(.t ext+0x9b8): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :SetAt(unsigned short const&, XNVAMsgValue*)'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::Cl eanupMap()':
xnvamsgrcv.o(.t ext+0x9e2): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :Iterate()'
xnvamsgrcv.o(.t ext+0xa0b): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :GetNext(unsign ed short&, XNVAMsgValue*&) '
xnvamsgrcv.o(.t ext+0xa46): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :RemoveAll()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::It erateValues()':
xnvamsgrcv.o(.t ext+0xa5c): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :Iterate()'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::Ge tNextValue(unsi gned char&, unsigned short&)':
xnvamsgrcv.o(.t ext+0xa87): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :GetNext(unsign ed short&, XNVAMsgValue*&) '
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
`XNVAMsgRcv::Ha sValue(unsigned short) const':
xnvamsgrcv.o(.t ext+0xaea): undefined reference to `XMap<unsigned
short, XNVAMsgValue*>: :Lookup(unsigne d short const&, XNVAMsgValue*&)
const'
/home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function

I appreciate all help on this problem.

Thanks,
Raghu
Jul 19 '05 #1
2 13122
"RU" <ru****@easylin k.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
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,CH eader*>. 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,CH eader*>.

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,CH eader*> in lib2, because CHeader
is defined in the application.

RU

"Victor Bazarov" <v.********@att Abi.com> wrote in message news:<vi******* *****@corp.supe rnews.com>...
"RU" <ru****@easylin k.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3363
by: david | last post by:
Hi, I have some problems to link a simple hello world program using g++ (version 3.2.3 or 3.3) and dinkumware 402. //hallo world... #include <iostream> main () { std::cout << "bla" << std::endl; }
2
2522
by: Quansheng Liang | last post by:
Hello, I struggled with the problem of "undefined reference to `vtable ...`" while migrating a project from windows to linux. After searching the google I removed all the inline functions and now the link errors decreased from over 200 to 5. A great step! But one of my class derived from wxValidator can't be linked correctly though there is no any inline function in it. The error message: -----------------------
6
3313
by: Christian Christmann | last post by:
Hi, I've created a file htable.cpp which I compiled to htable.o and than added with "ar" to a library libbasics.a in the directory lib/Linux/. Now I want to compile another file ir3tst.cpp which uses the functions of htable.cpp. I used the command: "g++ -Wall ir3tst.cpp -o bin/Linux/ir3tst -Llib/Linux -lbasics" and get some errors "undefined reference to ..." the functions from htable.cpp.
10
21104
by: siroregano | last post by:
Hello- I've got a nice C program written that uses libsndfile (#include <sndfile.h>) to convert my raw data into a properly-formatted wav file. The program is composed of a single .c file that compiles without error under gnu/linux. Unfortunately, when ld tries to link the file, I get the following: bash> gcc -Wall -D_GNU_SOURCE wavconvert.c -o wavconvert
5
11360
by: druberego | last post by:
I read google and tried to find the solution myself. YES I do know that you can get undefined references if you: a) forget to implement the code for a prototype/header file item, or b) you forget to pass all the necessary object files to the linker. Neither of those are my problem. Please bear with me as the question I ask is rather long and I think it's beyond a CS101 level of linker stupidity. If it is a stupid CS101 mistake I'm making...
2
6015
by: Manuel T | last post by:
Hello everybody, I'm trying to port a project from Windows+Cygwin to Linux(i'm working on a Debian-like: Kubuntu), but I'm facing a lot of linking problems. This project needs libraries xerces and gsl, more specifically libxerces-c, libgsl, libgslblas. The project comes with an own makefile, automatically generated by Eclipse cdt on Windows, on wich I made some change to fit it for Linux.
8
5623
by: wdh3rd | last post by:
I'm still new at C and can't solve this problem. I've looked through the FAQ and on the Web, but am not having luck. I'm getting an "undefined reference" error as well as a "Id returned 1 exit status" error. I've pared down the code to a simple example: ---------------------------------square.c ---------------------------------------------------
3
11599
by: prakash.mirji | last post by:
Hello, I am getting below mention linker error when I tried to link my class test.C I use below command to compile test.C /usr/bin/g++ -g -fpic -fvisibility=default -D_POSIX_SOURCE -DTRACING - D__EXTENSIONS__ -D__RWCOMPILER_H__ -D_REENTRANT -D_RWCONFIG=8s - D_RWCONFIG_12d -D_RWSTDDEBUG -DRWDEBUG -o test1 test1.o -L/lib -
3
35930
by: tvnaidu | last post by:
I compiled tinyxml files (.cpp files) and when I am linking to create final exe in Linux, I am getting lot of errors saying "undefiend reference" to "operator new" and "delete", any idea?. Main.cpp:377: undefined reference to `operator delete(void*)' tinyXML/include/tinystr.h:259: undefined reference to `operator delete(void*)' ../common/tinyXML/include/tinyxml.h:1401: undefined reference to `operator delete(void*)'...
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.