Search code examples
c++iosc++11static-librariesxcodebuild

IOS target link the cocoa stack library which has the library write in the C++11 standard error


I am working on a project, it's a cocoa static library that used the C++ library which is written by others. This C++ library used the C++11, and libc++(LLVM C++ standard library with C++ 11 support).

I built the cocoa library successfully, but when I link this library in the App(just add link in the "Link Binary with Libraries").

Error happens, This is the error log:

"non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:


  "non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:


  "non-virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:


  "non-virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:


  "non-virtual thunk to std::__1::basic_istream<wchar_t, std::__1::char_traits<wchar_t> >::~basic_istream()", referenced from:


  "non-virtual thunk to std::__1::basic_istream<wchar_t, std::__1::char_traits<wchar_t> >::~basic_istream()", referenced from:


  "non-virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:


  "non-virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:


  "non-virtual thunk to std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::~basic_ostream()", referenced from:


  "non-virtual thunk to std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >::~basic_ostream()", referenced from:


  "non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:


  "non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:


  "operator delete[](void*)", referenced from:


  "operator delete(void*)", referenced from:


  "operator new[](unsigned long)", referenced from:


  "operator new(unsigned long)", referenced from:


  "___cxa_begin_catch", referenced from:


  "___cxa_end_catch", referenced from:


  "___cxa_pure_virtual", referenced from:


  "___cxa_rethrow", referenced from:


  "___gxx_personality_v0", referenced from:


  "_crc32", referenced from:


  "_deflate", referenced from:


  "_deflateEnd", referenced from:


  "_deflateInit2_", referenced from:


  "_get_crc_table", referenced from:


  "_inflate", referenced from:


  "_inflateEnd", referenced from:


  "_inflateInit2_", referenced from:

It looks like the issuse about linking the C++11 library, But I have no idea about it. Maybe linking the cocoa static library in APP used libstdc++ standard, no the C++11 standard, So the conflict happened at here. But I don't confirm this.

Could you help me ?

Thanks


Solution

  • Because I missed to link the libc++.dylib library.

    So producing these errors.

    Note: the Clang support C++11.