473,513 Members | 3,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linker error: undefined reference

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 -
lTrackList -L/opt/ossasn1/linux-glibc2.2.trial/8.2.0-betaA/lib -
Bstatic -losstoed -Bdynamic -L/opt/RogueWave/SourcePro/Ed9_Eval/lib -
lpop32212d -lthread2412d -litc2312d -lfunctor_list2312d -
linternet2212d -lfunctor2312d -lpointer2512d -lsync2412d -
lthrexcept2312d -ltrace2312d -lnetwork1812d -ltls71012d -L/lib -
lConfigFw -L/Scan/lib -lScan -lnsl -ldl -lm

----------------
Here is my linker error

/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x272): In function
`Scan::Scan(unsigned char const*, long)':
/home/pmirji/psalms/common/Scan/src/Scan.C:69: undefined reference to
`ConfigFile::getString(RWCString const&, RWCString const&)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x5a8): In function
`Scan::Scan(unsigned char const*, long)':
/home/pmirji/psalms/common/Scan/src/Scan.C:69: undefined reference to
`ConfigFile::getString(RWCString const&, RWCString const&)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0xd95): In function
`Scan::setScanAndInsert(RWCString const&, SepTime const&)':
/home/pmirji/psalms/common/Scan/src/Scan.C:164: undefined reference to
`DataSetRow::getField(char const*)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0xdf0):/home/pmirji/
psalms/common/Scan/src/Scan.C:166: undefined reference to
`DataSetRow::getField(char const*)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0xe5e):/home/pmirji/
psalms/common/Scan/src/Scan.C:173: undefined reference to
`DataSetRow::getField(char const*)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0xe8a):/home/pmirji/
psalms/common/Scan/src/Scan.C:175: undefined reference to
`DataSetRow::getField(char const*)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0xeb4):/home/pmirji/
psalms/common/Scan/src/Scan.C:178: undefined reference to
`DataSetRow::getField(char const*)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0xf04):/home/pmirji/
psalms/common/Scan/src/Scan.C:179: more undefined references to
`DataSetRow::getField(char const*)' follow
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x11e3): In function
`Scan::setScanAndInsert(RWCString const&, SepTime const&)':
/home/pmirji/psalms/common/Scan/src/Scan.C:192: undefined reference to
`SRSException::printStackTrace(char const*, int, int)'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x18b3):/home/pmirji/
psalms/common/Scan/src/Scan.C:212: undefined reference to
`DataSet::SynchWindow()'
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x1e12):/home/pmirji/
psalms/common/Scan/src/Scan.C:223: undefined reference to
`SRSException::printStackTrace(char const*, int, int)'

..............
..............
getString(RWCString const&, RWCString const&)' is static method
declared in ConfigFile.[h,C]. Actually all methods are static.

If I follow standard c++ header file declaration I mean without .h
extension and use 'using namespace std', linker error 'undefined
reference' goes off.
Don't know how this is related to static methods.

any idea?. Please help me.

Thanks & Regards,
Prakash

May 8 '07 #1
3 11586
pr***********@gmail.com wrote:
I am getting below mention linker error when I tried to link my class
test.C

I use below command to compile test.C

[...compiler-specific...]

----------------
Here is my linker error

/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x272): In function
`Scan::Scan(unsigned char const*, long)':
/home/pmirji/psalms/common/Scan/src/Scan.C:69: undefined reference to
`ConfigFile::getString(RWCString const&, RWCString const&)'
[..]

getString(RWCString const&, RWCString const&)' is static method
declared in ConfigFile.[h,C]. Actually all methods are static.

If I follow standard c++ header file declaration I mean without .h
extension and use 'using namespace std', linker error 'undefined
reference' goes off.
Goes *off*? Do you mean "goes away"?
Don't know how this is related to static methods.

any idea?. Please help me.
Try reordering libraries in your command-line. The one containing the
'ConfigFile::getString' should follow theonw with 'Scan::Scan'. Any
other questions about how to compile and how to order libraries should
be asked in the compiler-specific newsgroup. Try 'gnu.g++.help'.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 8 '07 #2
On May 8, 6:51 am, prakash.mi...@gmail.com wrote:
any idea?. Please help me.
It looks like your code uses the Rogue Wave libraries, a commercial
package.

You should check their documentation on how to link on your system.

May 8 '07 #3
On May 8, 6:16 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
prakash.mi...@gmail.com wrote:
I am getting below mentionlinkererrorwhen I tried to link my class
test.C
I use below command to compile test.C
[...compiler-specific...]
----------------
Here is mylinkererror
/psalms/common/Scan/lib/libScan.a(Scan.o)(.text+0x272): In function
`Scan::Scan(unsigned char const*, long)':
/home/pmirji/psalms/common/Scan/src/Scan.C:69: undefined reference to
`ConfigFile::getString(RWCString const&, RWCString const&)'
[..]
getString(RWCString const&, RWCString const&)' is static method
declared in ConfigFile.[h,C]. Actually all methods are static.
If I follow standard c++ header file declaration I mean without .h
extension and use 'using namespace std',linkererror'undefined
reference' goes off.

Goes *off*? Do you mean "goes away"?
Don't know how this is related to static methods.
any idea?. Please help me.

Try reordering libraries in your command-line. The one containing the
'ConfigFile::getString' should follow theonw with 'Scan::Scan'. Any
other questions about how to compile and how to order libraries should
be asked in the compiler-specific newsgroup. Try 'gnu.g++.help'.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask- Hide quoted text -

- Show quoted text -
reordering libraries takes care of my linker error.
Thank you very much.

Regards,
Prakash

May 10 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1545
by: GammaJoe | last post by:
I'm relatively new to C++, and so when I ran across these linker errors, I really didn't know how to fix them. I did a groups.google search, and found plenty of issues with parameterized classes, or using the wrong compiler, or a variety of other things that don't apply to my problem. So, if anyone could help me out, that'd be great. ...
3
1808
by: Lord Labakudas | last post by:
Hi, I have the following simple template implementation: // -------------- b.h ----------------- // template <class t> class b { public: b() ;
12
801
by: Baloff | last post by:
Hello I have this linker error which makes me think that the definition file is not being seen by the linker, this code is taken from "Thinking in C++, 2nd Edition, Volume 1, Annotated Solutions Guide" Using Dev-C++ 4.9.9.2, The error is: undefined reference to ‘f(int)’ all the following files are in the same dir. thanks
4
5858
by: Mark | last post by:
Hi, I'm trying to write some classes that kind of manage themselves. A linked list, that links different types of objects. Here's the code... object.h: --- class Object { int alt;
5
2644
by: Mark | last post by:
Sorry for creating such a newbish topic, but I just can't seem to figure out what the problem is here. // main.cpp #include <cstdlib> #include <iostream> #include "Vector.h" using namespace std;
1
1953
by: Herman.Schultz | last post by:
I am getting the following undefined reference linker error when I compile my program: FileModule.o: In function `DoFile': /home/herman/src/FileModule.cpp:665: undefined reference to `VLC_Init' collect2: ld returned 1 exit status I have added libvlc.so file to my 'LIBFILES in my Makefile: LIBFILES = QTFileLib/libQTFileLib.a \...
1
2056
by: mubbashir | last post by:
I just created a program and used public inheritance. when compiling I am getting linker error of this kind. undefined reference to `Person::Person(char *)' undefined reference to `Person::~Person(void)' undefined reference to `Student::~Student(void)'
6
3512
by: Ed Dana | last post by:
I'm trying to create a dynamic two dimensional array. My code looks like this: ====================================================================== #define DEF_FrameBuffer_H class FrameBuffer { public: FrameBuffer(int prmWidth, int prmHeight, unsigned long prmPen); FrameBuffer(int prmWidth, int prmHeight);
3
3586
by: Rahul | last post by:
Hi Everyone, I have the following polymorphic classes, class Shape { public : virtual void draw() { } virtual void sample();
0
7270
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...
0
7563
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...
1
7125
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...
0
5703
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...
1
5102
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3252
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...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.