我正在尝试手动将 freetype 2.9.0 作为框架构建目标添加到我在 Xcode 中的玩具项目中。 Freetype 使用预处理器宏将其 header 包含在尖括号 ( <freetype/config/xx.h>
) 中,这混淆了 Xcode 构建系统,我得到错误 expected "FILENAME" or <FILENAME>
,说明找不到我的系统级包含。我将如何配置 Xcode 构建系统来查找这些配置文件,而不是对子文件夹 header 进行硬编码?
我在另一个文件中试过了
#define SOME_CONFIG <glfw/glfw3.h> /*this header is included as a system header in a subfolder <project/glfw/... , and works fine*/
#ifdef SOME_CONFIG
#include SOME_CONFIG
#endif
而且效果很好。但是当我用 freetype 尝试这个时,它无法在宏中找到扩展。
freetype 包含结构如下所示:
include/ftbuild.h -- points to include/freetype/config/ftheader.h
include/config/ftheader.h -- has all the #define macros to ->
include/config/... -- a bunch of headers with options which Xcode refuse to see
最佳答案
显然它实际上一直在工作我只是忘记将环境变量 FT2_BUILD_LIBRARY 添加到调试和发布版本中,并且我将它设置为调试,所以内部头文件宏没有被预编译,因此找不到。在 Xcode 9 中完美地完成我想做的事情。
关于c++ - Xcode 预处理器宏以包含系统样式 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49471379/