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

Linker error: undefined reference

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.