3

我将企业库绑定到我的 Monotouch 应用程序。自从 Objective Sharpie 未能创建 API 以来,这是一个艰巨的过程,我不得不发挥创造力。
但是现在,在编译终于成功后,我面临着一个链接问题

Undefined symbols for architecture armv7:
  "std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
      __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in libWeANDSFLibrary.a(WfStringBody.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int)in libWeANDSFLibrary.a(WfStringBody.o)
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)in libWeANDSFLibrary.a(WfStringBody.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int)in libWeANDSFLibrary.a(WfStringBody.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      wflang::CWfStringBody::Float64ToArray(double, unsigned short*)in libWeANDSFLibrary.a(WfStringBody.o)
      std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_ostringstream()in libWeANDSFLibrary.a(WfStringBody.o)
      std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_ostringstream()in libWeANDSFLibrary.a(WfStringBody.o)
      virtual thunk to std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_ostringstream()in libWeANDSFLibrary.a(WfStringBody.o)
      virtual thunk to std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_ostringstream()in libWeANDSFLibrary.a(WfStringBody.o)
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringbuf()in libWeANDSFLibrary.a(WfStringBody.o)
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringbuf()in libWeANDSFLibrary.a(WfStringBody.o)
      ...

等等。我尝试按照在 Objective-C 中包装 C++ 库中的建议没有隐藏 C++ 符号,但它没有用。任何想法?

4

2 回答 2

4

您好,您似乎正在使用非 C++ 编译器进行编译,您可能想尝试在您的iOS 项目选项中设置它,或者在LinkWith attribute您应该IsCxx = trueiOS 绑定项目中设置

iOS 项目构建选项的可用选项是

  • --编译器:gcc
  • --编译器:g++
  • --编译器:clang
  • --编译器:clang++

你应该尝试--compiler:g++或者--compiler:clang++

图片

希望这可以帮助

亚历克斯

于 2013-08-29T16:27:16.343 回答
2

所以最终解决问题的是使用链接标准 C++ 库

LinkerFlags="-lsqlite3.0 -lc++"

我的整个 LinkWith 属性如下所示:

[程序集:LinkWith ("libMyLibrary.a", LinkTarget = LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, SmartLink = true, ForceLoad = true, IsCxx = true, Frameworks = "SystemConfiguration CoreLocation CoreTelephony MobileCoreServices MessageUI", LinkerFlags=" -lsqlite3.0 -lc++")]

于 2013-09-04T04:58:46.147 回答