agmcleod
agmcleod

Reputation: 13621

Installed freetype through homebrew, can't seem to include headers correctly

On my xcode project, I added the dylib of freetype to the project Link Binary phase.

I ensure /usr/local/include and /usr/local/lib are in search paths in the build settings.

I then include:

#include <freetype2/ft2build.h>
#include FT_FREETYPE_H

But i get an error that freetype.h was not found. Any ideas? I tried including <freetype2/freetype.h> directly, but that leads to more compile problems with include paths in other freetype files.

Upvotes: 3

Views: 1244

Answers (1)

Brent Bradburn
Brent Bradburn

Reputation: 54929

Looking at the demo programs in "freetype2-demos", I see:

#include <ft2build.h>
#include FT_FREETYPE_H

Also, I think you need your compiler command-line to include -I (path to freetype includes).

For example...

g++ -I (...)/freetype2 myfile.cpp

Here are the instructions. The suggestion there is to compile with something like...

g++ $(freetype-config --cflags) myfile.cpp

...which, if you system is configured correctly, will incorporate the -I option that I previously mentioned.

Upvotes: 2

Related Questions