0

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.

Matt
  • 1,518
  • 4
  • 16
  • 30
Waserabi
  • 1
  • 1
  • 1

1 Answers1

2

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

Fire Lancer
  • 29,364
  • 31
  • 116
  • 182
  • How does "#include " in my code need to be changed after installing libftgl-dev? – Waserabi Oct 01 '18 at 10:54
  • You can just use it, if you look in those packages there is a `/usr/include/FTGL/ftgl.h`. It also has the library to link, `/usr/lib/x86_64-linux-gnu/libftgl.a`. – Fire Lancer Oct 01 '18 at 11:03
  • I download libfgtl-dev and put the folder in usr/include, but the compiler showed the same error. Is it conflicting with the FTGL folder that was already there? – Waserabi Oct 01 '18 at 12:18
  • You don't download and extract the package / archive file, you install it (and only part of it goes in `/usr/include` anyway). For modern Debian based (including Ubuntu) the tool to do so in a terminal is `apt install`, there is also a GUI for package management. – Fire Lancer Oct 01 '18 at 12:51