旧项目在xcode10遇到的问题

1、 Multiple commands produce

Multiple commands produce '/

方案一

修改 Xcode 的配置暂时解决了编译报错的问题。

Xcode -> File -> Workspace settings -> Build System,选择 Legacy Build System

方案二

  1. 选择打开所在的项目Target -> Build Phases -> Copy Bundle Resources
  2. 删除报错的那些文件

2. library not found for -lstdc++.6.0.9

Xcode10不支持libstdc++系列的库了、需要删掉并且换成libc++系列的库。有些第三方由于没有更新,会牵扯到这个库,所以运行后报错。

方案一

打开Build Phases -> Link Binary With Libraries,删除lstdc++.6.0.9依赖

有可能还有删除Build Setting -> Other Linker Flags里的-l"stdc++.6.0.9"

但是现在部分第三方SDK依旧要依赖于lstdc++.6.0.9.tbd动态库,如果对代码进行改动或者修改 Xcode 的配置,可能会造成其他问题,例如在Xcode9.4上再次运行的时候可能会出现报错等等。

方案二

最简单解决该问题的方法就是从 Xcode9.4 中找到动态库lstdc++.6.0.9.tbdlibstdc++.6.tbdlibstdc++.tbd文件复制到 Xcode10 下就可以完美解决问题。

  • 真机

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/

  • 模拟器

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/

libstdc++文件下载链接

3. ld: symbol(s) not found for architecture x86_64

前面两个问题解决后,就遇到了这个问题,目前,用xcode10 在iOS12模拟器运行的时候会报这个错误,用iOS11模拟器试过也不行,而使用真机运行的话没有问题。

Undefined symbols for architecture x86_64:
  "std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::string::assign(std::string const&)", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::basic_fstream >::open(char const*, std::_Ios_Openmode)", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::basic_fstream >::close()", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::string::_Rep::_S_empty_rep_storage", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::ios_base::Init::~Init()", referenced from:
      __GLOBAL__sub_I_BVMDOfflineMapMerge.cpp in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::basic_fstream >::~basic_fstream()", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::string::_Rep::_M_destroy(std::allocator const&)", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::ostream::tellp()", referenced from:
      _baidu_framework::MergeDataPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::ostream::write(char const*, long)", referenced from:
      _baidu_framework::MergeNamePart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeIndexPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeDataPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::istream::seekg(long long, std::_Ios_Seekdir)", referenced from:
      _baidu_framework::MergeIndexPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeDataPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::CheckPatchMd5(std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::ios_base::Init::Init()", referenced from:
      __GLOBAL__sub_I_BVMDOfflineMapMerge.cpp in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::basic_fstream >::basic_fstream()", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::istream::tellg()", referenced from:
      _baidu_framework::MergeNamePart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeIndexPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeDataPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::CheckPatchMd5(std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::__throw_length_error(char const*)", referenced from:
      std::vector<_baidu_vi::CVPtrRef<_baidu_framework::CTextureData>, std::allocator<_baidu_vi::CVPtrRef<_baidu_framework::CTextureData> > >::_M_fill_insert(__gnu_cxx::__normal_iterator<_baidu_vi::CVPtrRef<_baidu_framework::CTextureData>*, std::vector<_baidu_vi::CVPtrRef<_baidu_framework::CTextureData>, std::allocator<_baidu_vi::CVPtrRef<_baidu_framework::CTextureData> > > >, unsigned long, _baidu_vi::CVPtrRef<_baidu_framework::CTextureData> const&) in BaiduMapAPI_Map(TextureDataLoader.o)
  "std::istream::read(char*, long)", referenced from:
      _baidu_framework::MergeNamePart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeIndexPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::MergeDataPart(std::basic_fstream >&, std::basic_fstream >&, std::basic_fstream >&, _baidu_framework::tagVectorMapFile&, int) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::CheckPatchMd5(std::basic_fstream >&) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
  "std::basic_filebuf >::is_open() const", referenced from:
      _baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

你可能感兴趣的:(旧项目在xcode10遇到的问题)