[英]ld: building for iOS Simulator, but linking against dylib?
I'm having a issue compiling my app for Simulator. 我在为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)
I checked before posting this question, but the answers I found in stackoverflow, like to run this, 我在发布这个问题之前检查过,但我在stackoverflow中找到的答案,比如运行这个,
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
or 要么
The problem was that Xcode 5 replaces gcc with clang and adds in a "-triple" option that specifies OSX as the target. 问题是Xcode 5用clang替换了gcc并添加了一个“-triple”选项,指定OSX作为目标。 If you pass "-miphoneos-version-min=7.0" on both gcc command lines it works. 如果你在两个gcc命令行上传递“-miphoneos-version-min = 7.0”,它就可以工作。 You can see the clang command line if you pass "--verbose" to gcc. 如果将“--verbose”传递给gcc,则可以看到clang命令行。 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.xctoolchain/usr/bin:/Applications/Xcode5-DP6.app/Contents/Developer/usr/bin:$PATH None of this is official.. but works for me so far. 还需要添加到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这些都不是官方的..但到目前为止对我有用。
I dont really understand how to to do this. 我真的不明白该怎么做。 Any help, please? 有什么帮助吗?
Check Build Settings
for your test target. 检查测试目标的Build Settings
。 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! 另请注意:订单很重要!
PS from GraehamF It's always a good thing to Build -> Clean
and restart Xcode, so the changes to take affect 来自GraehamF的PS Build -> Clean
并重新启动Xcode总是一件好事,所以更改才会生效
When I faced this error with an XCode project, I open the file ???.xcodeproj
(in a SubLime Text editor) and removed the below lines. 当我使用XCode项目遇到此错误时,我打开文件???.xcodeproj
(在SubLime文本编辑器中)并删除下面的行。 The warning will no longer be there! 警告将不再存在!
LIBRARY_SEARCH_PATHS = (
"\"${PROJECT_DIR}/../../../../../usr/lib\"/**",
"\"${PROJECT_DIR}/../../../../../usr/lib\"/**",
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.