Question

I'm trying to link against libupnpx, followed the instructions but I can't seem to link against the C++ standard library.

Other linker flags are set to -lstdc++ -all_load (as you can see here), however, it can't seem to find C++ functions : here.

Any idea what I might be missing ?

Thanks.

EDIT : As @Speeder asked, here are the full logs :

Ld /Users/Maxime/Library/Developer/Xcode/DerivedData/OrangeTV-gjzdhpgbpshbbndllvftwfurgmek/Build/Products/Debug-iphonesimulator/OrangeTV.app/OrangeTV normal x86_64
cd /Users/Maxime/Documents/OrangeTV/OrangeTV
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/Maxime/Library/Developer/Xcode/DerivedData/OrangeTV-gjzdhpgbpshbbndllvftwfurgmek/Build/Products/Debug-iphonesimulator -L../Third-Party -L../Third-Party/upnpx -L../Third-Party/upnpx/api -L../Third-Party/upnpx/common -L../Third-Party/upnpx/eventserver -L../Third-Party/upnpx/generator -L../Third-Party/upnpx/port -L../Third-Party/upnpx/ssdp -L../Third-Party/upnpx/upnp -L../Third-Party/upnpx/port/ios -L../Third-Party/upnpx/port/macos -F/Users/Maxime/Library/Developer/Xcode/DerivedData/OrangeTV-gjzdhpgbpshbbndllvftwfurgmek/Build/Products/Debug-iphonesimulator -filelist /Users/Maxime/Library/Developer/Xcode/DerivedData/OrangeTV-gjzdhpgbpshbbndllvftwfurgmek/Build/Intermediates/OrangeTV.build/Debug-iphonesimulator/OrangeTV.build/Objects-normal/x86_64/OrangeTV.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -lstdc++ -all_load -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -lupnpx -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/Maxime/Library/Developer/Xcode/DerivedData/OrangeTV-gjzdhpgbpshbbndllvftwfurgmek/Build/Intermediates/OrangeTV.build/Debug-iphonesimulator/OrangeTV.build/Objects-normal/x86_64/OrangeTV_dependency_info.dat -o /Users/Maxime/Library/Developer/Xcode/DerivedData/OrangeTV-gjzdhpgbpshbbndllvftwfurgmek/Build/Products/Debug-iphonesimulator/OrangeTV.app/OrangeTV

Undefined symbols for architecture x86_64:
"std::string::find(char const*, unsigned long) const", referenced from:
  SSDPSearchResp::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpsearchresp.o)
  SSDPNotifyAlive::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpnotifyalive.o)
"std::string::c_str() const", referenced from:
  BasicHTTPObserver_wrapper::CanProcessMethod(std::string*) in libupnpx.a(BasicHTTPServer_ObjC.o)
  BasicHTTPObserver_wrapper::Request(char*, unsigned short, std::string*, std::string*, std::string*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >*, char*, int) in libupnpx.a(BasicHTTPServer_ObjC.o)
  -[SSDPDBDevice_ObjC initWithCPPDevice:] in libupnpx.a(SSDPDB_ObjC.o)
  SSDP::Search() in libupnpx.a(ssdp.o)
  SSDPDB::DeleteDevice(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  SSDPDB::DeleteDevicesByUuid(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  SSDPDB::GetDevice(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  ...
"std::string::length() const", referenced from:
  SSDPDB::DeleteDevice(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  SSDPDB::DeleteDevicesByUuid(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  SSDPDB::GetDevice(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  SSDPDB::UpdateCacheControl(unsigned char*, unsigned int, int) in libupnpx.a(ssdpdb.o)
"std::string::compare(std::string const&) const", referenced from:
  bool std::operator<<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libupnpx.a(httpsession.o)
  bool std::operator<<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libupnpx.a(BasicHTTPServer_ObjC.o)
  bool std::operator<<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libupnpx.a(basichttpserver.o)
"std::allocator<char>::allocator()", referenced from:
  SSDP::SSDP() in libupnpx.a(ssdp.o)
  BasicHTTPServer::DataReceived(sockaddr_in*, int, unsigned char*) in libupnpx.a(basichttpserver.o)
"std::allocator<char>::~allocator()", referenced from:
  SSDP::SSDP() in libupnpx.a(ssdp.o)
  BasicHTTPServer::DataReceived(sockaddr_in*, int, unsigned char*) in libupnpx.a(basichttpserver.o)
"std::string::assign(char const*, unsigned long)", referenced from:
  SSDPSearchResp::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpsearchresp.o)
  SSDPDB::InsertDevice(unsigned char*, unsigned int) in libupnpx.a(ssdpdb.o)
  SSDPNotifyAlive::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpnotifyalive.o)
"std::string::replace(unsigned long, unsigned long, char const*)", referenced from:
  SSDPSearchResp::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpsearchresp.o)
  SSDPNotifyAlive::Process(sockaddr*, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpnotifyalive.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
  SSDP::SSDP() in libupnpx.a(ssdp.o)
  BasicHTTPServer::DataReceived(sockaddr_in*, int, unsigned char*) in libupnpx.a(basichttpserver.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from:
  std::pair<std::string const, std::string>::pair(std::string const&, std::string const&) in libupnpx.a(httpsession.o)
  std::pair<std::string const, std::string>::pair(std::pair<std::string const, std::string> const&) in libupnpx.a(httpsession.o)
  std::pair<std::string const, std::string>::pair(std::string const&, std::string const&) in libupnpx.a(BasicHTTPServer_ObjC.o)
  std::pair<std::string const, std::string>::pair(std::pair<std::string const, std::string> const&) in libupnpx.a(BasicHTTPServer_ObjC.o)
  std::pair<std::string const, HTTPSession*>::pair(std::string const&, HTTPSession* const&) in libupnpx.a(basichttpserver.o)
  std::pair<std::string const, HTTPSession*>::pair(std::pair<std::string const, HTTPSession*> const&) in libupnpx.a(basichttpserver.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()", referenced from:
  HTTPSession::HTTPSession(char*, unsigned short) in libupnpx.a(httpsession.o)
  HTTPSession::ParseHeader(unsigned char*, int) in libupnpx.a(httpsession.o)
  std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::operator[](std::string const&) in libupnpx.a(httpsession.o)
  BasicHTTPObserver_wrapper::Response(int*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >*, char**, int*) in libupnpx.a(BasicHTTPServer_ObjC.o)
  std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::operator[](std::string const&) in libupnpx.a(BasicHTTPServer_ObjC.o)
  ___cxx_global_var_init in libupnpx.a(ssdp.o)
  ___cxx_global_var_init9 in libupnpx.a(ssdp.o)
  ...
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from:
  HTTPSession::HTTPSession(char*, unsigned short) in libupnpx.a(httpsession.o)
  HTTPSession::~HTTPSession() in libupnpx.a(httpsession.o)
  HTTPSession::ParseHeader(unsigned char*, int) in libupnpx.a(httpsession.o)
  std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::operator[](std::string const&) in libupnpx.a(httpsession.o)
  std::pair<std::string const, std::string>::~pair() in libupnpx.a(httpsession.o)
  std::pair<std::string const, std::string>::pair(std::string const&, std::string const&) in libupnpx.a(httpsession.o)
  std::pair<std::string const, std::string>::pair(std::pair<std::string const, std::string> const&) in libupnpx.a(httpsession.o)
  ...
"std::string::operator=(char const*)", referenced from:
  HTTPSession::ParseHeader(unsigned char*, int) in libupnpx.a(httpsession.o)
  BasicHTTPObserver_wrapper::Response(int*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >*, char**, int*) in libupnpx.a(BasicHTTPServer_ObjC.o)
  SSDP::SetOS(char const*) in libupnpx.a(ssdp.o)
  SSDP::SetProduct(char const*) in libupnpx.a(ssdp.o)
  SSDPDBDevice::SSDPDBDevice() in libupnpx.a(ssdpdbdevice.o)
"std::string::operator=(std::string const&)", referenced from:
  HTTPSession::ParseHeader(unsigned char*, int) in libupnpx.a(httpsession.o)
  BasicHTTPObserver_wrapper::Response(int*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >*, char**, int*) in libupnpx.a(BasicHTTPServer_ObjC.o)
"std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from:
  std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator--() in libupnpx.a(httpsession.o)
  std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator--() in libupnpx.a(BasicHTTPServer_ObjC.o)
  std::_Rb_tree_iterator<std::pair<std::string const, HTTPSession*> >::operator--() in libupnpx.a(basichttpserver.o)
"std::_Rb_tree_increment(std::_Rb_tree_node_base const*)", referenced from:
  std::_Rb_tree_const_iterator<std::pair<std::string const, std::string> >::operator++(int) in libupnpx.a(BasicHTTPServer_ObjC.o)
"std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from:
  std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator++() in libupnpx.a(httpsession.o)
  std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator++() in libupnpx.a(BasicHTTPServer_ObjC.o)
  std::_Rb_tree_iterator<std::pair<std::string const, HTTPSession*> >::operator++(int) in libupnpx.a(basichttpserver.o)
  std::_Rb_tree_iterator<std::pair<std::string const, HTTPSession*> >::operator++() in libupnpx.a(basichttpserver.o)
"std::__throw_length_error(char const*)", referenced from:
  std::vector<SSDPObserver*, std::allocator<SSDPObserver*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SSDPObserver**, std::vector<SSDPObserver*, std::allocator<SSDPObserver*> > >, SSDPObserver* const&) in libupnpx.a(ssdp.o)
  std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SSDP_HTTP_HEADER**, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> > >, SSDP_HTTP_HEADER* const&) in libupnpx.a(ssdpmessage.o)
  std::vector<BasicHTTPObserver*, std::allocator<BasicHTTPObserver*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<BasicHTTPObserver**, std::vector<BasicHTTPObserver*, std::allocator<BasicHTTPObserver*> > >, BasicHTTPObserver* const&) in libupnpx.a(basichttpserver.o)
  std::vector<SocketServerConnection*, std::allocator<SocketServerConnection*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SocketServerConnection**, std::vector<SocketServerConnection*, std::allocator<SocketServerConnection*> > >, SocketServerConnection* const&) in libupnpx.a(socketserver.o)
  std::vector<SocketServerObserver*, std::allocator<SocketServerObserver*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SocketServerObserver**, std::vector<SocketServerObserver*, std::allocator<SocketServerObserver*> > >, SocketServerObserver* const&) in libupnpx.a(socketserver.o)
  std::vector<SSDPDBObserver*, std::allocator<SSDPDBObserver*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SSDPDBObserver**, std::vector<SSDPDBObserver*, std::allocator<SSDPDBObserver*> > >, SSDPDBObserver* const&) in libupnpx.a(ssdpdb.o)
  std::vector<SSDPDBDevice*, std::allocator<SSDPDBDevice*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<SSDPDBDevice**, std::vector<SSDPDBDevice*, std::allocator<SSDPDBDevice*> > >, SSDPDBDevice* const&) in libupnpx.a(ssdpdb.o)
  ...
"std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
  std::_Rb_tree<std::string, std::pair<std::string const, HTTPSession*>, std::_Select1st<std::pair<std::string const, HTTPSession*> >, std::less<std::string>, std::allocator<std::pair<std::string const, HTTPSession*> > >::erase(std::_Rb_tree_iterator<std::pair<std::string const, HTTPSession*> >) in libupnpx.a(basichttpserver.o)
"std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
  std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::string const, std::string> const&) in libupnpx.a(httpsession.o)
  std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::string const, std::string> const&) in libupnpx.a(BasicHTTPServer_ObjC.o)
  std::_Rb_tree<std::string, std::pair<std::string const, HTTPSession*>, std::_Select1st<std::pair<std::string const, HTTPSession*> >, std::less<std::string>, std::allocator<std::pair<std::string const, HTTPSession*> > >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<std::string const, HTTPSession*> const&) in libupnpx.a(basichttpserver.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Was it helpful?

Solution

I know it's not really an answer, but I've ended up using Cocoapods to import the library. Can't believe I haven't checked that it was available that way before !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top