Undefined Reference Error while linking with g++, STL on LINUX

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RU

    Undefined Reference Error while linking with g++, STL on LINUX

    Hi,

    I am working on a porting project to port C/C++ application from
    unixware C++, AT&T Standard components to g++ with STL on Linux. This
    application has been working properly on Unixware/C++/AT&T componets
    environment.

    I have been able to compile all modules after making necessary changes
    in LINUX/gcc/STL environment. We have two templates defined XList and
    XMap.

    I am getting following errors when I try to link all the modules. All
    errors are related to templates XList and XMap.

    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::~X NVAMsgRcv [not-in-charge]()':
    xnvamsgrcv.o(.t ext+0xfb): undefined reference to `XMap<unsigned short,
    XNVAMsgValue*>: :~XMap [in-charge]()'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::~X NVAMsgRcv [in-charge]()':
    xnvamsgrcv.o(.t ext+0x16f): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :~XMap [in-charge]()'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::~X NVAMsgRcv [in-charge deleting]()':
    xnvamsgrcv.o(.t ext+0x1e3): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :~XMap [in-charge]()'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::Mo rphBequeath(XNV AMsgRcv*)':
    xnvamsgrcv.o(.t ext+0x258): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :Iterate()'
    xnvamsgrcv.o(.t ext+0x285): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :GetNext(unsign ed short&, XNVAMsgValue*&) '
    xnvamsgrcv.o(.t ext+0x2a7): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :SetAt(unsigned short const&, XNVAMsgValue*)'
    xnvamsgrcv.o(.t ext+0x2ec): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :RemoveAll()'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::Di spatchPayload(u nsigned char const*, unsigned char,
    unsigned short, unsigned long, unsigned long, unsigned long&)':
    xnvamsgrcv.o(.t ext+0x8b5): undefined reference to
    `XList<XNVAMsgR cv*>::IsEmpty() const'
    xnvamsgrcv.o(.t ext+0x8f5): undefined reference to
    `XList<XNVAMsgR cv*>::GetTail() const'
    xnvamsgrcv.o(.t ext+0x94f): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :Lookup(unsigne d short const&, XNVAMsgValue*&)
    const'
    xnvamsgrcv.o(.t ext+0x9b8): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :SetAt(unsigned short const&, XNVAMsgValue*)'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::Cl eanupMap()':
    xnvamsgrcv.o(.t ext+0x9e2): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :Iterate()'
    xnvamsgrcv.o(.t ext+0xa0b): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :GetNext(unsign ed short&, XNVAMsgValue*&) '
    xnvamsgrcv.o(.t ext+0xa46): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :RemoveAll()'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::It erateValues()':
    xnvamsgrcv.o(.t ext+0xa5c): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :Iterate()'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::Ge tNextValue(unsi gned char&, unsigned short&)':
    xnvamsgrcv.o(.t ext+0xa87): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :GetNext(unsign ed short&, XNVAMsgValue*&) '
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function
    `XNVAMsgRcv::Ha sValue(unsigned short) const':
    xnvamsgrcv.o(.t ext+0xaea): undefined reference to `XMap<unsigned
    short, XNVAMsgValue*>: :Lookup(unsigne d short const&, XNVAMsgValue*&)
    const'
    /home/udupa/R5Inbound/lib/libxwrk.a(xnvam sgrcv.o): In function

    I appreciate all help on this problem.

    Thanks,
    Raghu
  • Victor Bazarov

    #2
    Re: Undefined Reference Error while linking with g++, STL on LINUX

    "RU" <rudupa@easylin k.com> wrote...[color=blue]
    > I am working on a porting project to port C/C++ application from
    > unixware C++, AT&T Standard components to g++ with STL on Linux. This
    > application has been working properly on Unixware/C++/AT&T componets
    > environment.
    >
    > I have been able to compile all modules after making necessary changes
    > in LINUX/gcc/STL environment. We have two templates defined XList and
    > XMap.
    >
    > I am getting following errors when I try to link all the modules. All
    > errors are related to templates XList and XMap.
    > [...][/color]

    Try putting the implementation of those functions in the header.


    Comment

    • RU

      #3
      Re: Undefined Reference Error while linking with g++, STL on LINUX

      This is my setup:
      1)Library Setup:
      1.1) lib1.cpp and lib1.hpp has class definition and declaration of
      class CString
      1.2) lib2.cpp and lib2.hpp has class definition and declaration of a
      template class XMap that uses map template class provided by STL.

      2)Application Setup:
      2.1) mod1.cpp and mod1.hpp has class definition and declaration
      required for application. In this module, we are defining another
      class
      CHeader, and later on, define an object XMap<CString,CH eader*>. XMap
      is defined in lib2, CString is defined in lib1 and CHeader is
      defined in mod1.
      2.2) main.c invokes methods in mod1.

      All four modules compile without error. When linking, I am getting
      undefined error on XMap<CString,CH eader*>.

      We are trying to port UNIXWARE C++ AT&T component application to LINUX
      g++3.2.2 STL environment.

      I appreciate all help in this matter.

      I can not instantiate XMap<CString,CH eader*> in lib2, because CHeader
      is defined in the application.

      RU

      "Victor Bazarov" <v.Abazarov@att Abi.com> wrote in message news:<vitmi68t5 3dna0@corp.supe rnews.com>...[color=blue]
      > "RU" <rudupa@easylin k.com> wrote...[color=green]
      > > I am working on a porting project to port C/C++ application from
      > > unixware C++, AT&T Standard components to g++ with STL on Linux. This
      > > application has been working properly on Unixware/C++/AT&T componets
      > > environment.
      > >
      > > I have been able to compile all modules after making necessary changes
      > > in LINUX/gcc/STL environment. We have two templates defined XList and
      > > XMap.
      > >
      > > I am getting following errors when I try to link all the modules. All
      > > errors are related to templates XList and XMap.
      > > [...][/color]
      >
      > Try putting the implementation of those functions in the header.[/color]

      Comment

      Working...