How to fix 'ft2build.h: No such file or directory'

If your compiler shows you build errors like this:

/usr/include/opencascade/Font_FTLibrary.hxx:23:10: fatal error: ft2build.h: No such file or directory

you are missing the ft2build.h header file from libfreetype.

In order to install it on Ubuntu, use

sudo apt-get install libfreetype6-dev

If the error persists, you might want to add /usr/include/freetype2 to the include path. For GCC/G++, add

-I/usr/include/freetype2

to the command line arguments of the compiler.

If you use CMake, you can use a line like this in your CMakeLists.txt:

include_directories (/usr/include/freetype2)