Linker error: undefined reference

Discussion in 'C++' started by prakash.mirji@gmail.com, May 8, 2007.

  1. Guest

    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, 2007
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, May 8, 2007
    #2
    1. Advertising

  3. Guest

    On May 8, 6:51 am, 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, 2007
    #3
  4. Guest

    On May 8, 6:16 pm, "Victor Bazarov" <> wrote:
    > 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, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    695
    Jules
    Aug 18, 2005
  2. Replies:
    4
    Views:
    1,663
    Peter Jansson
    Dec 16, 2005
  3. Mark
    Replies:
    4
    Views:
    6,183
    Githlar
    Mar 13, 2006
  4. Oliver Bleckmann
    Replies:
    1
    Views:
    536
    Rud1ger Sch1erz
    Nov 30, 2006
  5. Replies:
    1
    Views:
    354
Loading...

Share This Page