clang:error:链接器命令失败,退出代码1 - 找不到库 [英] clang: error: linker command failed with exit code 1 - library not found

查看:820
本文介绍了clang:error:链接器命令失败,退出代码1 - 找不到库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题建立我的项目。我从上周以来有一些原因,得到的贝壳错误,不能摆脱它。

  Ld / Users / Nathan / Library / Developer / Xcode / DerivedData / SmartPic-elnbgmemojraijcotdlcskagbibq / Build / Products / Debug-iphoneos / SmartPic.app/SmartPic normal armv7 
cd/ Users / Nathan / Documents / Xcode Projects / SmartPic
setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
setenv PATH/Applications/Xcode.app/Contents/Developer/平台/ iPhoneOS.platform / Developer / usr / bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/ usr / bin:/ bin:/ usr / sbin:/ sbin
/ Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-L ​​/ Users / Nathan / Library / Developer / Xcode / DerivedData / SmartPic-elnbgmemojraijcotdlcskagbibq / Build / Products / Debug-iphoneos
-F / Users / Nathan / Library / Developer / Xcode / DerivedData / SmartPic -elnbgmemojraijcotdlcskagbibq / Build / Products / Debug-iphoneos -filelist /Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Intermediates/SmartPic.build/Debug-iphoneos/SmartPic.build/Objects-normal/armv7 /SmartPic.LinkFileList -dead_strip -miphoneos-version-min = 4.3 -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework EventKit -framework EventKitUI -framework MessageUI -lz -framework CoreLocation -framework UIKit -framework Foundation -framework CoreGraphics -framework QuartzCore - 框架AVFoundation -framework CoreMedia -framework CoreMotion -framework CoreVideo -framework AudioToolbox -lDMReader -o /Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Products/Debug-iphoneos/SmartPic.app/SmartPic

ld:没有为-lDMReader
找到库clang:error:linker命令失败,退出代码1(使用-v查看调用)
pre>

我搜索了关于erorr的信息,因为,有一点,我有6个其他类似的,答案是删除库搜索路径在构建设置和除了这最后一个,除掉所有的。这一切都很好,直到我进口一些额外的框架和类。所以不确定是什么造成的,以及如何解决它。



我还是相当新的应用程序开发,所以请尽量不要得到



任何帮助都非常感谢。

解决方案

通过将构建设置中的库搜索路径更改为

来解决此问题。


./类$(SRCROOT)/ Classes p>

只要其他人找到这个并想试试。



编辑:
只是添加,我有同样的问题,只是现在实际上。发生在我身上的原因是因为我改变了.xcodeproj文件所在的文件夹名称。所以在我的Mac上的文件夹中有一个名为应用程序名称的目录和名为 App Name.xcodeproj 的文件夹。我改变目录应用程序名称到不同的东西,尽管更新了xcode中的构建设置,仍然有同样的问题。我必须做的是




  • 右键点击 App Name.xcodeproj

  • 点击显示包内容

  • 打开 project.pbxproj

  • 然后cmd + f(搜索)并输入应用程序名称,我认为只有两个地方,他们是1 / 3下面,调用 name ,紧接在下面, path 。将它们更改为新目录名称,保存并重新打开您的项目,所有内容都应该很好。


I have a bit of a problem building my project. I'm getting the bellow error for some reason since last week and cannot get rid of it.

Ld /Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Products/Debug-iphoneos/SmartPic.app/SmartPic normal armv7
    cd "/Users/Nathan/Documents/Xcode Projects/SmartPic"
    setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
    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/iPhoneOS5.1.sdk
-L/Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Products/Debug-iphoneos
-F/Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Products/Debug-iphoneos -filelist /Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Intermediates/SmartPic.build/Debug-iphoneos/SmartPic.build/Objects-normal/armv7/SmartPic.LinkFileList -dead_strip -miphoneos-version-min=4.3 -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework EventKit -framework EventKitUI -framework MessageUI -lz -framework CoreLocation -framework UIKit -framework Foundation -framework CoreGraphics -framework QuartzCore -framework AVFoundation -framework CoreMedia -framework CoreMotion -framework CoreVideo -framework AudioToolbox -lDMReader -o /Users/Nathan/Library/Developer/Xcode/DerivedData/SmartPic-elnbgmemojraijcotdlcskagbibq/Build/Products/Debug-iphoneos/SmartPic.app/SmartPic

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

I searched for information about the erorr, as, at one point, I had 6 other similar ones and the answer was to delete Library Search Paths in the Build Settings and that got rid of all but this last one. It was all fine until I imported some extra frameworks and classes. So not sure really what's caused it and how I can fix it.

I'm still fairly new to app development, so please try not to get too technical.

Any help is much appreciated, thank you.

解决方案

Solved this by changing Library Search Paths in Build Settings to

./Classes "$(SRCROOT)/Classes"

Just in case anyone else finds this and wants to give it a try.

EDIT: Just to add, I had this same problem again just now actually. And the reason it happened for me is because I changed the folder name that sits with the .xcodeproj file. So In a folder on my mac I had a directory called App Name and file called App Name.xcodeproj. I changed the directory App Name to something different and despite updating the build settings in xcode, still had the same problem. What I had to do was

  • Right Click App Name.xcodeproj
  • Click Show Package Contents
  • Open project.pbxproj
  • Then cmd + f (search) and enter App Name, I think there were just two places and they were 1/3 of the way down the page, called name and immediately below, path. Change them to the new directory name, save and reopen your project and all should be well.

这篇关于clang:error:链接器命令失败,退出代码1 - 找不到库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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