Linker Command failed with exit code 1

1.当xcode编译出现这种错误提示的时候,右击问题-->Reveal in Log 查看详细的错误信息

 

2.通过log可以看到错误原因是:ld: library not found for -lstdc++.6.0.9

 

 

3.出现这种错误的原因是:

苹果在XCode10和iOS12中移除了libstdc++这个库,由libc++这个库取而代之,

苹果的解释是libstdc++已经标记为废弃有5年了,建议大家使用经过了llvm优化过并且全面支持C++11的libc++库。

解决方法:将xcode9中 libstdc++ 库导入到xcode10中

Xcode10支持手机:

将如下三个文件拷贝到:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/

libstdc++.6.0.9.tbd

libstdc++.6.tbd

libstdc++.tbd

这三个文件从Xcode9中--显示包内容获取。或者点此链接下载

 Xcode10支持模拟器:

方法和支持手机的一样,只是拷贝的路径不同

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
分别从Xcode9中相应的路径将这三个文件拷贝到Xcode10中相应的路径里
posted @ 2019-01-21 16:46  Ring_1992  阅读(338)  评论(0编辑  收藏  举报