Linker error: undefined reference

P

prakash.mirji

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
 
V

Victor Bazarov

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
 
F

faceman28208

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.
 
P

prakash.mirji

I am getting below mentionlinkererrorwhen I tried to link my class
test.C
I use below command to compile test.C
[...compiler-specific...]
/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
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top