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

If your compiler shows you build errors like this:

build_error_ft2build.txt
/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

install_libfreetype.sh
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

freetype_include_flag.txt
-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:

CMakeLists.txt
include_directories (/usr/include/freetype2)

Check out similar posts by category: C/C++