解决Xcode10 library not found for -lstdc++ 找不到问题

在Xcode9上正常编译的项目,在Xcode10上编译可能会遇到如下错误:

librarynotfoundfor-lstdc++.6.0.9

librarynotfoundfor-lstdc++.6

librarynotfoundfor-lstdc++

这是因为Xcode10彻底废弃了libstdc++,相关的库文件libstdc++.6.0.9.dylib、libstdc++.6.dylib、libstdc++.dylib、libstdc++.6.0.9.tbd、libstdc++.6.tbd、libstdc++.tbd也从Xcode10中删除了。

最好的解决办法还是尽快转到libc++开发

如果还想要继续在Xcode10上编译依赖libstdc++的项目或库,可以通过把Xcode9中的libstdc++相关库文件复制到Xcode10中即可。

在Xcode9中搜索libstdc++相关的库,可以找到四个相关的文件:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libstdc++.6.0.9.dylib 

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libstdc++.6.0.9.tbd

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.6.0.9.tbd

 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.6.0.9.tbd

但是只找到了libstdc++.6.0.9.dylib和libstdc++.6.0.9.tbd,找不到libstdc++.6.dylib、libstdc++.dylib、libstdc++.6.tbd、libstdc++.tbd,前往找到的这4个路径中会就会发现libstdc++.6.dylib、libstdc++.dylib是libstdc++.6.0.9.dylib的替身,libstdc++.6.tbd、libstdc++.tbd是libstdc++.6.0.9.tbd的替身:



所以我尝试将libstdc++.6.0.9.dylib和libstdc++.6.0.9.tbd复制到Xcode10中,并制作libstdc++.6.dylib、libstdc++.dylib、libstdc++.6.tbd、libstdc++.tbd这四个替身文件,但是在模拟器上运行崩溃,自己制作替身的方案不可行,然后我改为了制作副本的方式成功在模拟器上运行。

libstdc++.6.0.9.dylib和libstdc++.6.0.9.tbd以及制作好的副本libstdc++.6.dylib、libstdc++.dylib、libstdc++.6.tbd、libstdc++.tbd下载地址点这里

解决Xcode10 library not found for -lstdc++ 找不到问题 - 简书

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。