找不到-lobjc的xcode库 [英] xcode library not found for -lobjc

查看:444
本文介绍了找不到-lobjc的xcode库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在我的设备上运行它时,我收到此错误,但是当我在模拟器上运行它时工作正常。这是工具链错误还是SDK标头错误?以下是我在编译时获得的错误消息。

I am getting this error when I am trying to run it on my device, however it working fine when I run it on simulator. Is this a tool chain error or SDK header error? Below is the error message I obtain when compiling.

Ld /Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Intermediates/mobiletimetec.build/Debug-iphoneos/mobiletimetec.build/Objects-normal/armv7/mobiletimetec normal armv7
    cd /Users/KhangYu/Desktop/KPTesting/setting
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Products/Debug-iphoneos -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system -F/Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Intermediates/mobiletimetec.build/Debug-iphoneos/mobiletimetec.build/Objects-normal/armv7/mobiletimetec.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.1 -framework SystemConfiguration -framework AVFoundation -lsqlite3.0 -framework MapKit -framework CoreLocation -framework MessageUI -framework QuartzCore -framework Security -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Intermediates/mobiletimetec.build/Debug-iphoneos/mobiletimetec.build/Objects-normal/armv7/mobiletimetec







ld: library not found for -lobjc
clang: error: linker command failed with exit code 1 (use -v to see invocation)

// - 结束 -

//-- END --

这将是我的死亡。有关如何解决它的任何想法?非常感谢您的帮助。

This is going to be the death of me. Any idea on how to solve it? Your help will be greatly appreciated.

提前致谢。

感谢Kevin和Jasper Blues的回复,也感谢Reno Jones编辑我的帖子。
在尝试修复此问题数小时后,我将文件libobjc.A.dylib重命名为libobjc.dylib,错误消失。
P / S:libobjc.A.dylib - 位于/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer / SDKs / * / usr / lib /,再次感谢凯文。

Thanks Kevin and Jasper Blues reply and also thanks Reno Jones to edit my post. After hours of trying to fix this, I renamed the file "libobjc.A.dylib" to "libobjc.dylib"and the error disappear. P/S: "libobjc.A.dylib" - located in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer‌​/SDKs/*/usr/lib/, thanks again to Kevin.

推荐答案

我的猜测是它可以在模拟器上运行,但不能在设备上运行,因为你已经指定了单独的'OTHER LINKER FLAGS'用于'Debug'和'Release'配置。如果你在一个调试框架中链接,例如'Reveal','DCIntrospect'等,你通常会这样做。

My guess is that it works on the Simulator, but not the device because you've specified separate 'OTHER LINKER FLAGS' for both 'Debug' and 'Release' configurations. You'd usually do this if you're linking in a debug framework such as 'Reveal', 'DCIntrospect', etc.

'Release'看起来像不对。它应该是'-Objc'而不是'-lObjc' - 我们告诉编译器我们正在使用Objective-C本身,而不是加载一个名为'Objc'的库。

The one for 'Release' looks to be incorrect. It should be '-Objc' and not '-lObjc' - we're telling the compiler that we're using Objective-C itself, and not to load a library called 'Objc'.

要更正:


  • 在Xcode中,单击您的应用程序的目标。

  • 打开构建设置标签。

  • 搜索其他链接器标志 - 这样您就不会被选项所淹没。

  • 更正'发布'配置。将'-lObjc'更改为'-Objc'

  • In Xcode, click on the target for your App.
  • Open the 'Build Settings' tab.
  • Search for 'Other linker flags' - so you're not overwhelmed by options.
  • Correct the 'Release' config. Change '-lObjc' to '-Objc'

这篇关于找不到-lobjc的xcode库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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