ld:为iOS Simulator构建,但是与dylib链接吗? [英] ld: building for iOS Simulator, but linking against dylib?

查看:63
本文介绍了ld:为iOS Simulator构建,但是与dylib链接吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为Simulator编译应用程序时遇到问题.在设备上运行正常,但是一旦尝试在模拟器中进行编译,就会出现以下错误:

I'm having a issue compiling my app for Simulator. In the device runs perfectly but once I tried it to compile in simulator I get the following error:

ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我在发布此问题之前进行了检查,但是我在stackoverflow中找到的答案想运行它,

I checked before posting this question, but the answers I found in stackoverflow, like to run this,

export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct‌oolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH

问题是Xcode 5用clang替换了gcc,并添加了一个"-triple"选项,该选项将OSX指定为目标.如果您在两个gcc命令行上都传递了"-miphoneos-version-min = 7.0",则它可以正常工作.如果将"--verbose"传递给gcc,则可以看到clang命令行.还必须将其添加到Xcode 5的PATH中,以便cmake可以找到必要的工具:export PATH =/Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xct‌oolchain/usr/bin:/Applications /Xcode5-DP6.app/Contents/Developer/usr/bin:$PATH这都不是官方的..但到目前为止对我有用.

The problem was that Xcode 5 replaces gcc with clang and adds in a "-triple" option that specifies OSX as the target. If you pass "-miphoneos-version-min=7.0" on both gcc command lines it works. You can see the clang command line if you pass "--verbose" to gcc. It's also necessary to add to the PATH for Xcode 5 so that cmake can find the necessary tools: export PATH=/Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xct‌​oolchain/usr/bin:/Applications/Xcode5-DP6.app/Contents/Developer/usr/bin:$PATH None of this is official.. but works for me so far.

我真的不知道该怎么做.有什么帮助吗?

I dont really understand how to to do this. Any help, please?

推荐答案

检查Build Settings作为测试目标.此值应类似于:

Check Build Settings for your test target. This values should look similar:

如果您有任何转义的符号,请考虑对其进行修复.我在这里:\".我刚刚删除了它们

If you have any escaped symbol, consider to fix it. I had here : \". I just removed them

还请注意:顺序很重要!

Also notice: order is important!

P.S.来自GraehamF Build -> Clean并重新启动Xcode总是一件好事,因此所做的更改才能生效

P.S. from GraehamF It's always a good thing to Build -> Clean and restart Xcode, so the changes to take affect

这篇关于ld:为iOS Simulator构建,但是与dylib链接吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆