I can't use FTGL (ft2build.h not found)

6.4k views Asked by At

I wanted to use FTGL library, and I downloaded freetype2 because the compiler said

/usr/include/FTGL/ftgl.h:32:10: fatal error: ft2build.h: No such file or directory #include ^~~~~~~~~~~~ compilation teminated.

So, I put freetype-2.9.1 folder in /usr/include/FTGL, confirmed ft2build.h is in freetype-2.9.1/devel. Then I tried to compile, but the compiler still gives the same error. How can I fix this? I run Ubuntu 18.04 on Virtualbox. Any help will be appreciated.

1

There are 1 answers

4
Fire Lancer On

FreeType is a separate library, you can not simply put it "inside" the FTGL directory, it goes by itself. In addition to being in the wrong place, if you download it your self, it will also need seperately compiling to give you the dynamic or static Freetype library to link.

Generally speaking for any such error manually check your include path to see if the header is there or if it needs adding to your include path.

Id also note that generally on Linux such popular packages are already available pre-compiled. In this case you might look at libftgl-dev for FTGL rather than your own. If you need a different version, for FreeType you might use say libfreetype6-dev. You can also browse the packages online if you want a simple way to see what is included, e.g. https://packages.ubuntu.com/xenial/libftgl-dev and https://packages.ubuntu.com/xenial/amd64/libftgl-dev/filelist