Xcode找不到我的静态库! [英] Xcode can't find my static library!
问题描述
这是链接器错误:
i686-apple-darwin10-gcc-4.2.1:/Users/william/Documents/SettingsLibrary/build/Debug-iphonesimulator/libSettingsLibrary.a:没有这样的文件或目录命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2失败,退出代码为1
i686-apple-darwin10-gcc-4.2.1: /Users/william/Documents/SettingsLibrary/build/Debug-iphonesimulator/libSettingsLibrary.a: No such file or directory Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
一些奇怪的事情,可能是发生了什么的线索:
A couple of weird things, which may be clues to what is going on:
1)在我的库搜索路径"中,我包括了库项目的递归路径:
../SettingsLibrary/**
1) In my "library search paths", I have included the recursive path to the library project:
../SettingsLibrary/**
但是,SettingsLibrary会自行构建为SettingsLibrary/build/Debug/iphoneos/libSettingsLibrary.a
同时,根据错误消息,链接器似乎正在查找:SettingsLibrary/build/Debug-iphonesimulator/libSettingsLibrary.a
However, SettingsLibrary builds itself to SettingsLibrary/build/Debug/iphoneos/libSettingsLibrary.a
Meanwhile, based on the error message, the linker appears to be looking in:
SettingsLibrary/build/Debug-iphonesimulator/libSettingsLibrary.a
2)我已经将库项目包含在我的主项目中.在组和文件下单击鼠标右键时,可以选择是否将libSettingsLibrary.a文件包含在我的目标中.在我研究过的至少另一个使用图书馆的项目中,.a文件没有该复选框.
2) I have included the library project in my main project. When I right click under groups and files, there is an option to include the libSettingsLibrary.a file in my target or not. In at least one other library-using project I have looked at, that checkbox is not there for the .a file.
推荐答案
很难说您的项目出了什么问题.您可以在 Groups&中检查以下内容吗?主项目的文件视图:
It's difficult to say what the problem is with your project. Can you check the following in the Groups & File view of the main project:
- 静态库项目(SettingsLibrary.xcodeproj)是否显示为应用程序下方的节点(第一个节点)?
- 库文件(libSettingsLibrary.a)是否出现在下面?
- 静态库( SettingsLibrary(来自SettingsLibrary.xcodeproj))是否显示为主要目标(位于 Targets/YourApp )下的节点?
- 库文件(libSettingsLibrary.a)是否出现在节点使用库链接二进制文件(在目标"部分中)的正下方?
- Does the static library project (SettingsLibrary.xcodeproj) appear as a node below your app (the very first node)?
- Does the library file (libSettingsLibrary.a) appear just below?
- Does the static library (SettingsLibrary (from SettingsLibrary.xcodeproj) ) appear as a node below the main target (at Targets / YourApp)?
- Does the library file (libSettingsLibrary.a) appear just below the node Link Binary With Libraries (in the targets section)?
如果没有,什么遗漏了?
If not, what's missing?
此外,我的图书馆搜索路径为空.如果我在链接程序的命令行中查看,则它明确包含静态库的完整路径(在您的情况下为 SettingsLibrary/build/Debug/iphoneos/libSettingsLibrary.a ).
Furthermore, my Library Search Path is empty. If I look at the command line for the linker, it explicitly contains the full path to the static library (SettingsLibrary/build/Debug/iphoneos/libSettingsLibrary.a in your case).
还有您提到的复选框(右键单击 Groups& Files 中的静态库项目):我也有,但未选中.
And the checkbox you mention (right-clicking on the static library project within Groups & Files): I have it as well, but it's not checked.
这篇关于Xcode找不到我的静态库!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!