Reputation: 401
I am binding an enterprise library to my Monotouch application.
It has been an arduous process since Objective Sharpie failed to create the APIs and I had to get creative.
But now, after the compilation finally succeeded I'm faced with a linking problem
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)
...
Etc. I tried following the advice in Wrapping a C++ library in Objective-C is not hiding the C++ symbols but it didn't work. Any idea?
Upvotes: 3
Views: 2202
Reputation: 401
So what finally solved the problem was linking the standard C++ library using
LinkerFlags="-lsqlite3.0 -lc++"
My entire LinkWith attribute looks like this:
[assembly: 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++")]
Upvotes: 2
Reputation: 3412
Hello it seems you are compiling using a non c++ compiler, you might want to try setting it inside your iOS project options or inside the LinkWith attribute
you should set IsCxx = true
on your iOS binding Project
available options on iOS project build options are
you should try either --compiler:g++
or --compiler:clang++
Hope this helps
Alex
Upvotes: 4