带有非标准框架 ld 的 Xcode 警告:警告:找不到选项 -F 的目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19957458/
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
Xcode warning with non-standard Framework ld: warning: directory not found for option -F
提问by Max MacLeod
Cleaning up warnings, I could see the following:
清理警告,我可以看到以下内容:
ld: warning: directory not found for option '-F/myPath/etc/myframework'
This was happening with non-standard iOS frameworks. How to eliminate the warning?
这发生在非标准的 iOS 框架中。如何消除警告?
回答by Max MacLeod
Checking the man page of the linker ld
shows the following detail for the -Fdir
option:
检查链接器的手册页ld
显示该-Fdir
选项的以下详细信息:
Add dir to the list of directories in which to search for frameworks. Directories specified with -F are searched in the order they appear on the command line and before the default search path. In Xcode4 and later, there can be a space between the -F and directory.
将 dir 添加到搜索框架的目录列表中。使用 -F 指定的目录将按照它们在命令行中出现的顺序并在默认搜索路径之前进行搜索。在 Xcode4 及更高版本中,-F 和目录之间可以有一个空格。
Sure enough, checking the project.pbxproj
showed the missing folder:
果然,检查project.pbxproj
显示丢失的文件夹:
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"\"myPath/etc/myframework\"",
);
So, I thought the whole deal with frameworks was that they avoided all this hassle. Well, that's true for standardframeworks, i.e. the SDK ones. For anything else, more tweakery is required. From Framework Programming Guide:
所以,我认为框架的整个处理是它们避免了所有这些麻烦。嗯,这对于标准框架来说是正确的,即 SDK 框架。对于其他任何事情,都需要更多的调整。从框架编程指南:
Locating Frameworks in Non-Standard Directories
If your project links to frameworks that are not included in any of the standard locations, you must explicitly specify the location of that framework before Xcode can locate its header files. To specify the location of such a framework, add the directory containing the framework to the “Framework Search Paths” option of your Xcode project. Xcode passes this list of directories to the compiler and linker, which both use the list to search for the framework resources.
Note: The standard locations for frameworks are the /System/Library/Frameworks directory and the /Library/Frameworks directory on the local system.
在非标准目录中定位框架
如果您的项目链接到未包含在任何标准位置中的框架,则您必须明确指定该框架的位置,然后 Xcode 才能找到其头文件。要指定此类框架的位置,请将包含该框架的目录添加到 Xcode 项目的“框架搜索路径”选项中。Xcode 将此目录列表传递给编译器和链接器,它们都使用该列表来搜索框架资源。
注意:框架的标准位置是本地系统上的 /System/Library/Frameworks 目录和 /Library/Frameworks 目录。
Turns out in Xcode's Build Settings, there is a specific entry for Framework Search Paths.
原来在 Xcode 的构建设置中,有一个特定的框架搜索路径条目。
Adding the generic catch-all entry of $(SRCROOT)
as per the answer to this questiondid the business and eliminated the warnings. Oh, and don't forget to set the drop down to "Recursive".
$(SRCROOT)
根据这个问题的答案添加通用的全能条目完成了业务并消除了警告。哦,别忘了将下拉菜单设置为 "Recursive"。