iPhone 应用程序上的 Xcode 链接器错误(仅在模拟器上)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2528114/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode linker error on iPhone app (Only on simulator)
提问by RexOnRoids
Im getting this linker error that won't let me compile. It only happens on the simulator.
我收到这个链接器错误,它不会让我编译。它只发生在模拟器上。
KEY POINTS:
- Happens only in simulator
- Similar to THIS question, but found no FRAMEWORK_SEARCH_PATHS in my .pbxproj file
- Though my OS is 10.6.2, I had to build target 1.5 to avoid other linker errors
- libxml2.dylib ISrequired and is in my Frameworks group
- The other cited libraries I have never heard of.
- Tried bringing in those other Libs under frameworks, didn't solve.
要点:
-只发生在模拟器
-以类似这个问题,却发现我的.pbxproj文件中没有FRAMEWORK_SEARCH_PATHS
-虽然我的操作系统是10.6.2,我必须建立目标1.5,以避免其他链接错误
- libxml2.dylib IS必需的,在我的框架组中
- 我从未听说过的其他引用库。
- 尝试在框架下引入其他 Libs,没有解决。
Build SpaceTweet of project SpaceTweet with configuration Debug
Ld build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet normal i386
cd "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)"
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -L/Users/Scott/Desktop "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/../../libYAJLIPhone-0" -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib "-F/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -filelist "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/SpaceTweet.build/Debug-iphonesimulator/SpaceTweet.build/Objects-normal/i386/SpaceTweet.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework MessageUI -lYAJLIPhone -lxml2 -o "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet"
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libxml2.dylib, missing required architecture i386 in file
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libobjc.A.dylib, missing required architecture i386 in file
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
CLUE:
Again, MY question is very similar to THIS SOLVED QUESTIONexcept that in my case I did NOT find a FRAMEWORK_SEARCH_PATHS entry in the .pbxproj file in my project bundle and thus could not solve in the manner in which that question was solved.
线索:
同样,我的问题与这个已解决的问题非常相似,只是在我的情况下,我没有在我的项目包的 .pbxproj 文件中找到 FRAMEWORK_SEARCH_PATHS 条目,因此无法以解决该问题的方式解决。
回答by cdespinosa
The problem is this:
问题是这样的:
-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib
That's telling your Simulator (i386) build to use files from the Device (arm) /usr/lib.
这告诉您的模拟器 (i386) 构建使用来自设备 (arm) /usr/lib 的文件。
Find in your target where /usr/lib is (just use the Search bubble in the target's Get Info / Build Settings tab) and delete it. The compiler will use the correct platform's usr/lib if it's not told to use the wrong one first.
在您的目标中找到 /usr/lib 所在的位置(只需使用目标的“获取信息/构建设置”选项卡中的搜索气泡)并删除它。如果没有告诉编译器首先使用错误的 usr/lib,编译器将使用正确平台的 usr/lib。
回答by JasmineOT
I have the same issue. And it turns out to run my release version code on debug environment. Click "Edit schema..." and change Build Configuration to Release solved my problem.
我有同样的问题。结果是在调试环境中运行我的发布版本代码。单击“编辑架构...”并将构建配置更改为发布解决了我的问题。
回答by SpaceTrucker
I had the same thing happen to me. I deleted and re added all my frameworks and still had the same issue. To get rid of the error finally I had to delete the path pointing to the offending library from Library Search Paths under build settings.
我也发生了同样的事情。我删除并重新添加了我所有的框架,但仍然有同样的问题。为了最终摆脱错误,我不得不从构建设置下的库搜索路径中删除指向违规库的路径。