Xcode10 【libray not found for -lstdc++.6.0.9 】
简介
上周在打包上传后,报了一个警告,大致的意思就是这样的:2019年3月必需使用Xcode 10.1或者更高版本
,此时的我还在用 Xcode 9,恰好最近刚上了包,就更新了Xcode 10
开始采坑
1、更新完成后直接报了libray not found for -lstdc++.6.0.9
,在 Xcode 10 Release Notes 中有着如下的形容
Building with libstdc++ was deprecated with Xcode 8 and is not supported in Xcode 10 when targeting iOS. C++ projects must now migrate to libc++ and are recommended to set a deployment target of macOS 10.9 or later, or iOS 7 or later. Besides changing the C++ Standard Library build setting, developers should audit hard-coded linker flags and target dependencies to remove references to libstdc++ (including -lstdc++, -lstdc++.6.0.9, libstdc++.6.0.9.tbd, and libstdc++.6.0.9.dylib). Project dependencies such as static archives that were built against libstdc++ will also need to be rebuilt against libc++. (40885260)
所以苹果在 Xcode10 中移除了对 libstdc++ 的支持。
2、具体的报错可能会有这些
- libray not found for -lstdc++.6.0.9
- libray not found for -lstdc++
- libray not found for libstdc++.6.0.9.tbd
3、处理办法
- 在Build Phases -> Link Binary With Libraries 中删除
lstdc++
、lstdc++.6.0.9
、libstdc++.6.0.9.tbd
,并且增加libc++
。 - 对于有使用 pod 的项目,在debug.xcconfig和release.xcconfig中也需要删除
lstdc++.6.0.9
、
4、删除完了这些后还可能编译不成功的问题
我在做完这些操作后,我 clean 了项目,而后再次编译的时候,还是有报错,但是其实我已经把引用到这个库的地方都删掉了
image.png
我全局搜索了一下,在Build Settings 中找到了这个
image.png
image.png
image.png
接着就是在c++ standard Library 中选择 libc++ ,而后编译,成功处理了报错。
更新后关于Xs Max 和 XR的适配
花了一下午的时间更新了Xcode 10,接着就是关于iPhone Xs Max 和XR 的适配了
启动页的分辨率
Xs Max: 1242 * 2688
XR: 828*1792.png
少量判断用的宏
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)#define iPhone5 ([UIScreen mainScreen].bounds.size.height == 568)#define iPhone4 ([UIScreen mainScreen].bounds.size.height == 480)#define iPhone6 ([UIScreen mainScreen].bounds.size.height == 667)#define iPhone6P ([UIScreen mainScreen].bounds.size.height == 736)#define iPhoneX ([UIScreen mainScreen].bounds.size.height == 812)#define iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)#define iPhoneXsMax ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size)&& !isPad : NO)
脱坑
终于完成了 Xcode 9 到 Xcode 10 的迁移,总的来说比之前可能略微麻烦了少量。在此做个记录
参考
xsmax 的宏
Xcode 10 更新项目报错
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » Xcode10 【libray not found for -lstdc++.6.0.9 】