我得到这个链接器错误,不允许我编译。它只发生在模拟器上。
要点:
- 仅在模拟器中发生
- 与THIS question类似,但在我的.pbxproj文件中找不到FRAMEWORK_SEARCH_PATHS
- 虽然我的操作系统是10.6.2,但我必须构建目标1.5以避免其他链接器错误
- 需要libxml2.dylib IS ,并且在我的Frameworks组中
- 我从未听说过的其他引用的图书馆
- 试图在框架下引进其他自由人,没有解决
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
线索:
同样,我的问题与THIS SOLVED QUESTION非常相似,只是在我的情况下,我没有在项目包中的.pbxproj文件中找到FRAMEWORK_SEARCH_PATHS条目,因此无法以解决该问题的方式解决。 / p>
答案 0 :(得分:12)
问题在于:
-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib
这告诉你的模拟器(i386)构建使用Device(arm)/ usr / lib中的文件。
在目标中查找/ usr / lib(只需使用目标的“获取信息/构建设置”选项卡中的“搜索”气泡)并将其删除。编译器将使用正确的平台的usr / lib,如果它没有被告知首先使用错误的平台。
答案 1 :(得分:3)
我有同样的问题。事实证明,在调试环境中运行我的发布版本代码。单击“Edit schema ...”并将Build Configuration更改为Release解决了我的问题。
答案 2 :(得分:0)
我发生了同样的事情。我删除并重新添加了我的所有框架,但仍然遇到了同样的问题。为了最终消除错误,我不得不在构建设置下从库搜索路径中删除指向违规库的路径。