非标准Framework ld的Xcode警告:警告:找不到选项-F的目录 [英] Xcode warning with non-standard Framework ld: warning: directory not found for option -F

查看:83
本文介绍了非标准Framework ld的Xcode警告:警告:找不到选项-F的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

清除警告,可以看到以下内容:

Cleaning up warnings, I could see the following:

ld: warning: directory not found for option '-F/myPath/etc/myframework'

这是在非标准iOS框架中发生的.如何消除警告?

This was happening with non-standard iOS frameworks. How to eliminate the warning?

推荐答案

检查链接器ld的手册页会显示-Fdir选项的以下详细信息:

Checking the man page of the linker ld shows the following detail for the -Fdir option:

将dir添加到要在其中搜索框架的目录列表. 在目录中搜索用-F指定的目录. 顺序将它们显示在命令行上并且在默认搜索路径之前.在Xcode4和更高版本中,可以有一个空格 在-F和目录之间.

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.

果然,检查project.pbxproj显示缺少的文件夹:

Sure enough, checking the project.pbxproj showed the missing folder:

FRAMEWORK_SEARCH_PATHS = (
                    "\"$(SDKROOT)/Developer/Library/Frameworks\"",
                    "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
                    "\"myPath/etc/myframework\"",
                );

因此,我认为处理框架的全部目的是避免所有这些麻烦.嗯,对于 standard 框架(即SDK框架)来说确实如此.除此之外,还需要更多调整.来自《框架编程指南》 :

So, I thought the whole deal with frameworks was that they avoided all this hassle. Well, that's true for standard frameworks, i.e. the SDK ones. For anything else, more tweakery is required. From Framework Programming Guide:

非标准目录中的定位框架

Locating Frameworks in Non-Standard Directories

如果您的项目链接到以下任何未包含的框架 标准位置,您必须明确指定 Xcode可以在其头文件之前找到该框架.指定 此类框架的位置,请添加包含以下内容的目录: Xcode的框架搜索路径"选项的框架 项目. Xcode将此目录列表传递给编译器,然后 链接器,它们都使用列表来搜索框架资源.

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.

注意:框架的标准位置是 /System/Library/Frameworks目录和/Library/Frameworks 本地系统上的目录.

Note: The standard locations for frameworks are the /System/Library/Frameworks directory and the /Library/Frameworks directory on the local system.

在Xcode的Build Settings中找到,有一个特定的Framework Search Paths条目.

Turns out in Xcode's Build Settings, there is a specific entry for Framework Search Paths.

根据.

Adding the generic catch-all entry of $(SRCROOT) as per the answer to this question did the business and eliminated the warnings. Oh, and don't forget to set the drop down to "Recursive".

这篇关于非标准Framework ld的Xcode警告:警告:找不到选项-F的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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