xcode c linux 编译出错,Xcode编译报错的那些坑 (不定时更新)

在开发过程中,因为各种客观原因会使用不同版本的Xcode,如5.11. 6.1 6.2等等,而Xcode总是莫名其妙的报错T_T。 这里总结一些坑爹错误解决,简直是本人血泪历程。

1.Xcode6环境下打包静态库,在Xcode5项目中编译报错!

ld: framework not found Metal for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)

下面是我当时搜出的解决方法:

第一篇博客给出的解释是:使用xcode6编译就可以了。这个是因为使用的三方的.a文件是使用xcode6编译的,使用xcode5编译就会出现这个问题。xcode6会莫名其妙的链接Metal.framework

http://blog.sina.com.cn/s/blog_8d663a9c0102v63c.html

The reason behind this, is actually a bug / bad design by Apple, which failed to preserve backward compatibility for non-Metal devices (namely: armv7 & armv7s).

In XCode 5, Apple introduced a new linker flag, named “Link Frameworks Automatically”, which defaults to “YES”. The purpose of this flag is to reduce the effort required by developers when adding a framework. Before the introduction of this flag, developers had to link their projects with system frameworks prior to using them. This flag allows them to simply use the frameworks.

打包静态库的时候,有一个Link Frameworks Automatically设置,默认为YES,会自动链接框架。所以Xcode 6打包的静态库.a文件,在Xcode 5项目编译时候会提示找不到Metal的。

正确的解决方法:打包静态库时,Build Settings 中 Link Frameworks Automatically 把默认Yes 改成 No! 静态库就不会自动链接Metal了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值