Topic
  • 1 reply
  • Latest Post - ‏2013-05-29T10:58:22Z by flodstrom
JoseLuis3
JoseLuis3
1 Post

Pinned topic Linker error when compiling C++ program with xlc

‏2013-05-15T10:54:55Z |

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

 

  • flodstrom
    flodstrom
    115 Posts

    Re: Linker error when compiling C++ program with xlc

    ‏2013-05-29T10:58:22Z  

    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.