通过自制软件安装的 freetype,似乎无法正确包含 headers

Installed freetype through homebrew, can't seem to include headers correctly

在我的xcode项目中,我在项目Link二进制阶段添加了freetype的dylib。

我确保 /usr/local/include/usr/local/lib 在构建设置的搜索路径中。

然后我包括:

#include <freetype2/ft2build.h>
#include FT_FREETYPE_H

但是我收到一条错误消息,提示未找到 freetype.h。有任何想法吗?我尝试直接包含 <freetype2/freetype.h>,但这会导致其他自由类型文件中的包含路径出现更多编译问题。

查看 "freetype2-demos" 中的演示程序,我看到:

#include <ft2build.h>
#include FT_FREETYPE_H

此外,我认为您的编译器命令行需要包含 -I (path to freetype includes)

例如...

g++ -I (...)/freetype2 myfile.cpp

Here are the instructions。那里的建议是用类似...

的东西进行编译
g++ $(freetype-config --cflags) myfile.cpp

...如果您的系统配置正确,它将包含我之前提到的 -I 选项。