Las*_*ain 3 c++ g++ freetype freetype2
我试图使用freeglut2在OpenGL中渲染文本.当我包含以下标题时,
#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.
请帮我弄清问题.谢谢.
我去了这个,但没有任何效果.
您的编译器搜索包含in /usr/local/include,所以当您执行以下操作时:
#include <freetype2/ft2build.h>
Run Code Online (Sandbox Code Playgroud)
它找到了 /usr/local/include/freetype2/ft2build.h
但是这个文件试图包含freetype/config/ftheader.h但没有
/usr/local/include/freetype/config/ftheader.h
Run Code Online (Sandbox Code Playgroud)
但
/usr/local/include/freetyp2/freetype/config/ftheader.h
Run Code Online (Sandbox Code Playgroud)
所以你应该传递-I/usr/local/include/freetyp2给你的编译器并做一个
#include <ft2build.h>
Run Code Online (Sandbox Code Playgroud)
是正确的.
如果您的系统支持它 - 使用pkg-config实用程序,它可以提供所有编译标志,例如:
$ pkg-config --cflags freetype2
-I/usr/include/freetype2
$ pkg-config --libs freetype2
-lfreetype
Run Code Online (Sandbox Code Playgroud)