本文介绍了非标准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:

果然,检查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:

如果您的项目链接到以下任何未包含的框架 标准位置,您必须明确指定 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的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:34