AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
Expand all | Collapse all

Linker error when compiling C++ program with xlc

  • 1.  Linker error when compiling C++ program with xlc

    Posted Wed May 15, 2013 06:55 AM

    Originally posted by: JoseLuis3


    Hi,

    Why these linker errors?

    <<snip>>

    $ uname -a
    AIX madsfeapp21 3 5 00030175D600
    $ cat foo.C
    #include <iostream>
    #include <sstream>
    #include <string>
    using namespace std;

    int main()
    {
                string s("Somewhere down the road");
                    istringstream iss(s);
    }
    $ type xlC
    xlC is /usr/vacpp/bin/xlC
    $ ls -l /usr/vacpp/bin/xlC
    lrwxrwxrwx    1 bin      bin              16 Jan 23 23:41 /usr/vacpp/bin/xlC -> /usr/vac/bin/xlc
    $ xlC foo.C
    $ /usr/vac/bin/xlc -+ foo.C
    ld: 0711-317 ERROR: Undefined symbol: .operator delete(void*)
    ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::~ios_base()
    ld: 0711-317 ERROR: Undefined symbol: std::__vftQ2_3std8ios_base
    ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::_Init()
    ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::_Addstd()
    ld: 0711-317 ERROR: Undefined symbol: .std::_String_base::_Xran() const
    ld: 0711-317 ERROR: Undefined symbol: .std::_String_base::_Xlen() const
    ld: 0711-317 ERROR: Undefined symbol: .std::_Lockit::_Lockit(int)
    ld: 0711-317 ERROR: Undefined symbol: .std::locale::_Init()
    ld: 0711-317 ERROR: Undefined symbol: .std::_Lockit::~_Lockit()
    ld: 0711-317 ERROR: Undefined symbol: .__ReThrowV6
    ld: 0711-317 ERROR: Undefined symbol: .std::__setUncaughtExceptionFlag(bool)
    ld: 0711-317 ERROR: Undefined symbol: .std::unexpected()
    ld: 0711-317 ERROR: Undefined symbol: .std::terminate()
    ld: 0711-317 ERROR: Undefined symbol: .operator new(unsigned long)
    ld: 0711-317 ERROR: Undefined symbol: .__ThrowV6
    ld: 0711-317 ERROR: Undefined symbol: .__CleanupCatchV6a
    ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::clear(int,bool)
    ld: 0711-317 ERROR: Undefined symbol: std::_BADOFF
    ld: 0711-317 ERROR: Undefined symbol: .std::_Nomemory()
    ld: 0711-317 ERROR: Undefined symbol: std::_Fpz
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

     

    <<snip>>

     

    Thanks in advance,

    Jose Luis

     


    #AIX-Forum


  • 2.  Re: Linker error when compiling C++ program with xlc

    Posted Wed May 29, 2013 06:58 AM

    Originally posted by: flodstrom


    Why are you invocing the C compiler (xlc) to compile C++ code? The xlc and xlC may share the same binary, but most likely trigger on $0 to go into C or C++ mode. Also, the first argument yo are using "-+"?!?

    For the record, had no problems compiling the code on AIX 6.1 with XL C/C++ 10.1.

     


    #AIX-Forum