1

我正在做一个项目,它是一个使用别人编写的 C++ 库的可可静态库。这个 C++ 库使用了 C++11 和 libc++(支持 C++ 11 的 LLVM C++ 标准库)。

我成功构建了可可库,但是当我在应用程序中链接这个库时(只需在“链接二进制与库”中添加链接)。

发生错误,这是错误日志:

"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:

看起来像是关于链接 C++11 库的问题,但我对此一无所知。可能APP中连接cocoa静态库使用的是libstdc++标准,没有C++11标准,所以这里就发生了冲突。但我不确认这一点。

你可以帮帮我吗 ?

谢谢

4

1 回答 1

6

因为我错过了链接 libc++.dylib 库。

所以产生这些错误。

注意:Clang 支持 C++11。

于 2012-08-13T13:51:51.950 回答