在Objective-C中使用外部C ++头文件 [英] Use of external C++ headers in Objective-C
问题描述
在我的iOS项目中,我需要使用用C ++编写的外部库。 C ++的头文件都在一个目录。
In my iOS project I need to use an external library written in C++. The C++ header files are all in one directory.
我已经添加了这些C ++头文件到我的Xcode项目,并指定了标题搜索路径(在构建设置)。
I've added these C++ headers to my Xcode project, and also specified a header search path (in Build Settings).
问题是这些C ++标题包含彼此使用< >尖括号。这导致:
The issue is that these C++ headers include each other using < > angle brackets. This results in:
'filename.h' file not found with <angled> include, use "quotes" instead.
奇怪的是,Xcode不会抱怨所有标头。同样在一个文件中包含#include的标题也没问题,而在另一个文件中包含#include的问题。我认为这是因为这些标题相互包含#include。
The weird thing is that Xcode does not complain about all headers. Also the same header #include'd in one file is fine, while an issue when #include'd in another. I think this is caused by the fact that these headers #include each other.
- 为什么搜索路径不起作用?
- 有没有办法解决这个问题而不修改这些头文件?
谢谢!
推荐答案
#include <bla.h>
用于标准库或框架标题,搜索策略
与此不同用于
is meant for standard library or framework headers, and the search strategy Is different than that used for
#include "bla.h"
参见例如
- What is the difference between #include <filename> and #include "filename"?
作为一种变通方法,可以设置Xcode的构建设置总是搜索用户路径是。
As a workaround, you can set the Xcode build setting "Always Search User Paths" to YES.
这篇关于在Objective-C中使用外部C ++头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!