xcode clang:错误:链接器命令失败,退出代码 1 - 找不到库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9769744/
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
clang: error: linker command failed with exit code 1 - library not found
提问by Nathan
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.
我搜索了有关错误的信息,因为有一次,我有 6 个其他类似的错误,答案是删除构建设置中的库搜索路径,然后删除除最后一个之外的所有内容。一切都很好,直到我导入了一些额外的框架和类。所以不确定是什么导致了它以及我如何解决它。
I'm still fairly new to app development, so please try not to get tootechnical.
我对应用程序开发还很陌生,所以请尽量不要太技术化。
Any help is much appreciated, thank you.
非常感谢任何帮助,谢谢。
回答by Nathan
Solved this by changing Library Search Paths in Build Settings to
通过将构建设置中的库搜索路径更改为
./Classes "$(SRCROOT)/Classes"
./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
编辑:补充一下,实际上我刚才又遇到了同样的问题。它发生在我身上的原因是因为我更改了 .xcodeproj 文件所在的文件夹名称。所以在我的 mac 上的一个文件夹中,我有一个App Name
名为App Name.xcodeproj
. 我将目录 App Name 更改为不同的内容,尽管在 xcode 中更新了构建设置,但仍然遇到相同的问题。我必须做的是
- 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, calledname
and immediately below,path
. Change them to the new directory name, save and reopen your project and all should be well.
- 右键点击
App Name.xcodeproj
- 点击
Show Package Contents
- 打开
project.pbxproj
- 然后 cmd + f (search) 和 enter
App Name
,我认为只有两个地方,它们位于页面name
下方的1/3 处,被调用并紧接在下方,path
. 将它们更改为新目录名称,保存并重新打开您的项目,一切都应该没问题。