Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Linker error: undefined reference

Reply
Thread Tools

Linker error: undefined reference

 
 
prakash.mirji@gmail.com
Guest
Posts: n/a
 
      05-08-2007
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+0x5a: 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:rintStackTrace(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:rintStackTrace(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

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      05-08-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) 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


 
Reply With Quote
 
 
 
 
faceman28208@yahoo.com
Guest
Posts: n/a
 
      05-08-2007
On May 8, 6:51 am, (E-Mail Removed) 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.

 
Reply With Quote
 
prakash.mirji@gmail.com
Guest
Posts: n/a
 
      05-10-2007
On May 8, 6:16 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in an undefined reference linker error Herman.Schultz@gmail.com C++ 1 05-24-2007 09:06 PM
[Linker error] undefined reference to `CGI::query' Oliver Bleckmann C++ 1 11-30-2006 08:26 AM
[Linker error] undefined reference to vtable Mark C++ 4 03-13-2006 02:53 AM
[Linker error] undefined reference... pliki .h... dev-c++ s_4@wp.pl C++ 4 12-16-2005 07:15 PM
Compiler/Linker Error undefined reference to 'std::ios_base::Init::Init[in-charge]() clusardi2k@aol.com C++ 1 08-18-2005 07:11 PM



Advertisments