Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: freetype/config/ftheader.h

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.

like image 633
Laschet Jain Avatar asked Jan 20 '16 21:01

Laschet Jain


2 Answers

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  
like image 87
nsilent22 Avatar answered Oct 17 '22 16:10

nsilent22


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.

like image 36
Damyan Avatar answered Oct 17 '22 16:10

Damyan