框架头在 Xcode 中找不到自己的头文件?
在 Xcode 中,假设有一个名为 Foo
的框架。在 Foo.framework/Headers
文件夹内有文件 File1.h
和 File2.h
。头文件 File1.h
通过以下指令包含 File2.h
:
#include <File2.h>
Foo
框架是 C++ 库的重新封装,并非专门针对针对Mac。
现在假设我有一个链接到 Foo
框架的项目。它有一个文件 MyFile.mm
,其中通过以下指令包含 File1.h
:
#import <Foo/File1.h>
现在,当我尝试编译 MyFile.mm
时,它总是失败,因为找不到 File2.h
。如何在不修改 Foo
框架的头文件的情况下编译并运行它?
出于好奇,所讨论的实际框架是 Taglib 的框架打包版本取自 Max 源树。我尝试包含的文件是
并且编译包含它的 .mm
文件总是因 mp4tag.h< /code> 包含
,但在 include 指令中不包含
前缀。该错误不仅出现在这一个头文件中,而且大量头文件中也存在类似问题,因此修改所有这些包含语句并非易事。所有必需的“缺失”头文件实际上都存在于框架的 Header
子目录中。
我正在尝试在我的应用程序中使用 Taglib,尽管我能够将 Taglib 编译为带有头文件的框架并将其添加到我的应用程序中,但由于上述问题,我似乎无法编译应用程序。
有人有任何指点吗?
谢谢。
In Xcode, suppose that there is a framework named Foo
. Inside the Foo.framework/Headers
folder there are files File1.h
and File2.h
. The header file File1.h
includes File2.h
via the following directive:
#include <File2.h>
The Foo
framework is a re-package of a C++ library not specifically targeted for the Mac.
Now suppose I have a project that links to the Foo
framework. It has a file MyFile.mm
that includes File1.h
via the following directive:
#import <Foo/File1.h>
Now when I tried to compile MyFile.mm
, it always fails because it can't find File2.h
. How can I get this to compile and run without modifying the header files of the Foo
framework?
For the curious, the actual framework in question is a framework-packaged version of Taglib taken from the Max source tree. The file that I tried to include was <taglib/mp4.tag>
and compiling the .mm
file that includes it always fail due to mp4tag.h
is including <tag.h>
without the <taglib/...>
prefix in the include directive. The error is not only in this one header files, but there are similar issues in a large number of header files and thus modifying all of these include statements is non trivial. All of the required "missing" header files are actually present in the framework's Header
subdirectory.
I'm trying to use Taglib in my app and although I was able to compile Taglib as a framework with header files and add it to my app, I can't seem to get the app to compile due to the issues above.
Anybody has any pointers?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为
File1.h
应该说:尝试检查 Xcode 中的“始终搜索用户路径”选项。
I think that
File1.h
should say:Try checking the "Always Search User Paths" option in Xcode.
以下是修复该问题的步骤:
这应该可以解决问题,因为框架将以与使用框架的代码完全相同的方式引用文件。
Here are the steps to fix it:
This should fix the issue, as the framework will refer to the files exactly the same way as the code that uses the framework.