std string错误解决办法

Undefined symbols for architecture x86_64:
  "std::string::find_first_of(char const*, unsigned long, unsigned long) const", referenced from:
      CPackSenddata::sendSetupConfig_comm(CDvrDevice*, afk_config_channel_param_s*, int, int, int) in libnetsdk.a(PackSenddata.o)
      CDvrSearchChannel::getsearchname() in libnetsdk.a(dvrsearchchannel.o)
  "std::string::find(char const*, unsigned long, unsigned long) const", referenced from:
      CManager::GetDDNSInfo(_SearchMode&, _DDNS_INFO*, int, int&) in libnetsdk.a(Manager-4F887344A8D3A073.o)
  "std::string::find(char, unsigned long) const", referenced from:
      MakeSureDirectoryPath(char const*) in libnetsdk.a(PlayBack.o)
  "std::string::substr(unsigned long, unsigned long) const", referenced from:
      CManager::GetDDNSInfo(_SearchMode&, _DDNS_INFO*, int, int&) in libnetsdk.a(Manager-4F887344A8D3A073.o)
      MakeSureDirectoryPath(char const*) in libnetsdk.a(PlayBack.o)
      CPackSenddata::sendSetupConfig_comm(CDvrDevice*, afk_config_channel_param_s*, int, int, int) in libnetsdk.a(PackSenddata.o)
      CDvrSearchChannel::getsearchname() in libnetsdk.a(dvrsearchchannel.o)
  "std::string::compare(char const*) const", referenced from:
...下面省略...

根据信息来看,编译已经通过,但是在链接时出错,我们需要手动更改我们本地的链接设置。有以下两个方法

第一、Build Settings-->Apple LLVM 5.1 - Language - C++ --> C++ Standard Library,设置为:libstdc++(GNU C++ standard library)

std string错误解决办法_第1张图片

然后Clean工程,然后重新Build,看是否可以成功。

第二、如果上述设置仍旧不能解决你的问题,你还可以尝试Build Phases --> Link Binary With Libraries里面增加库:libstdc++.dylib

std string错误解决办法_第2张图片

备注:上述错误,也可能是由我们自带的SDK导致,具体到其他SDK可能还会有其他的错误。

如果这篇文章对您有些许帮助 请给我点个心哦。

你可能感兴趣的:(std string错误解决办法)