## Recommended Posts

NSDuo    329

I'm trying to get started with Freetype2 in my Xcode 4 project (on Mac OS X of course). I successfully compiled the library through the command line, and I got two dylibs and a static library. I figured I just add one of them to my project and I'll have access to the files right?

Obviously because I'm posting this, it didn't work.

#include<ft2build.h> // FILE NOT FOUND



The tutorials specified doing it like this.

#include<libfreetype/ft2build.h> // FILE STILL NOT FOUND


Nope.

#include<libfreetype.a/ft2build.h>
#include<libfreetype.dylib/ft2build.h> // HOW DID I THINK THIS WOULD WORK?


I was desperate with this attempt...

I also tried working with the header/library/framework search paths, but couldn't get Xcode to find the files

So...

Is there an additional step I didn't know about when adding a non-framework library to a project?

Could something have gone wrong when I made the libraries?

Should I be including them differently for Mac OS?

Did I not provide enough information about my problem? (I always do somehow...)

##### Share on other sites
Nercury    812
Libraries usually have header files, source code and a way to build (compile them). Header files usually are in directory named /include.

When you are compiling your project, it happens in two steps: compiling each .cpp into separate binary file and linking these binary blobs into single executable.

Header files describe (forward declare) stuff that is available in .cpp and that binary blob.

To compile .cpp file, you need all header files it uses (ft2build.h).

To link all binary blobs together, you need that compiled library (libfreetype.a) - it is a binary blob.

You have to add freetype's /include directory to your project's "include path list". When done, you can use "#include <ft2build.h>" to compile your files.

##### Share on other sites
NSDuo    329

It didn't work...

I added the static library and set the header search path to "usr/local": didn't work.

I changed the path to "usr/local/lib": didn't work.

I changed the path to "usr/local/include": I think it worked once, but when I added the next include it stopped working, and it won't work even when I set it back.

Is there a way to see where the compiler is actually looking?

##### Share on other sites
NSDuo    329

FIXED!!!

What I should have remembered is that my framework has a companion app to help test its functions. And it was the application failing to build when my framework was having no problems. Apparently I needed to:

1: Add the static library to my framework.

3: Then add "usr/local/include" and "usr/local/include/freetype2" as the companion application's header search paths.

EDIT: NOW FIXED

Edited by NSDuo