fatal error: freetype/config/ftheader.h
fatal error: freetype/config/ftheader.h
我正在尝试使用 freeglut2 在 OpenGL 中渲染文本。当我包含以下内容时 header,
#include <freetype2/ft2build.h>
它给出了以下错误:
/usr/local/include/freetype2/ft2build.h:37:38: fatal error: freetype/config/ftheader.h: No such file or directory
但是当我转到 /usr/local/include/freetype2/freetype/config
时,我找到了文件 ftheader.h.
请帮助我解决问题。谢谢。
我去了 this 但没有任何效果。
阅读本文档:http://freetype.org/freetype2/docs/tutorial/step1.html#section-1
您需要将 /usr/local/include/freetype2 添加到您的包含路径。
然后您将 ft2build.h 包含在:
#include <ft2build.h>
然后当 ft2build.h 包含 freetype/config/ftheader.h 时,它将在包含路径中的 freetype2 目录中查找并找到它。
您的编译器在 /usr/local/include
中搜索包含,因此当您这样做时:
#include <freetype2/ft2build.h>
它找到 /usr/local/include/freetype2/ft2build.h
但是这个文件试图包含 freetype/config/ftheader.h
但没有
/usr/local/include/freetype/config/ftheader.h
但是
/usr/local/include/freetyp2/freetype/config/ftheader.h
所以你应该将 -I/usr/local/include/freetyp2
传递给你的编译器并执行
#include <ft2build.h>
正确。
如果您的系统支持 - 使用 pkg-config
实用程序,它可以提供所有编译标志,例如:
$ pkg-config --cflags freetype2
-I/usr/include/freetype2
$ pkg-config --libs freetype2
-lfreetype
我正在尝试使用 freeglut2 在 OpenGL 中渲染文本。当我包含以下内容时 header,
#include <freetype2/ft2build.h>
它给出了以下错误:
/usr/local/include/freetype2/ft2build.h:37:38: fatal error: freetype/config/ftheader.h: No such file or directory
但是当我转到 /usr/local/include/freetype2/freetype/config
时,我找到了文件 ftheader.h.
请帮助我解决问题。谢谢。
我去了 this 但没有任何效果。
阅读本文档:http://freetype.org/freetype2/docs/tutorial/step1.html#section-1
您需要将 /usr/local/include/freetype2 添加到您的包含路径。
然后您将 ft2build.h 包含在:
#include <ft2build.h>
然后当 ft2build.h 包含 freetype/config/ftheader.h 时,它将在包含路径中的 freetype2 目录中查找并找到它。
您的编译器在 /usr/local/include
中搜索包含,因此当您这样做时:
#include <freetype2/ft2build.h>
它找到 /usr/local/include/freetype2/ft2build.h
但是这个文件试图包含 freetype/config/ftheader.h
但没有
/usr/local/include/freetype/config/ftheader.h
但是
/usr/local/include/freetyp2/freetype/config/ftheader.h
所以你应该将 -I/usr/local/include/freetyp2
传递给你的编译器并执行
#include <ft2build.h>
正确。
如果您的系统支持 - 使用 pkg-config
实用程序,它可以提供所有编译标志,例如:
$ pkg-config --cflags freetype2
-I/usr/include/freetype2
$ pkg-config --libs freetype2
-lfreetype