I am trying to use freeglut2 for rendering text in OpenGL. When I included the following header,
#include <freetype2/ft2build.h>
it gives the following error :
/usr/local/include/freetype2/ft2build.h:37:38: fatal error: freetype/config/ftheader.h: No such file or directory
But when I go to /usr/local/include/freetype2/freetype/config
, I found the file ftheader.h.
Please help me in figuring out the issue. Thank you.
I went to the this but nothing worked.
Your compiler searches for includes in /usr/local/include
, so when you do:
#include <freetype2/ft2build.h>
it finds /usr/local/include/freetype2/ft2build.h
but this file tries to include freetype/config/ftheader.h
and there is no
/usr/local/include/freetype/config/ftheader.h
but
/usr/local/include/freetyp2/freetype/config/ftheader.h
So you shall pass -I/usr/local/include/freetyp2
to your compiler and do a
#include <ft2build.h>
to be correct.
If your system supports it - use pkg-config
utility, which can provide all compilations flag, e.g.:
$ pkg-config --cflags freetype2
-I/usr/include/freetype2
$ pkg-config --libs freetype2
-lfreetype
From reading this documentation: http://freetype.org/freetype2/docs/tutorial/step1.html#section-1
You need to add /usr/local/include/freetype2 to your include path.
Then you include ft2build.h with:
#include <ft2build.h>
Then when ft2build.h includes freetype/config/ftheader.h it will look in freetype2 directory in the include path and find it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With