Using FTGL in XCode

I have had a search through the forums, but no-one seems to have had exactly the same problem as I have - probably because I don't 100% understand what I am doing.

So I have built libfreetype.a using configure & make, as I couldn't get the .pbproj to build correctly, since it was inconsistent with the source files.

I built libftgl.a (or whatever it's called) using the supplied XCode project, but in order to get it to build I had to add all the headers in the 'include' directory of freetype to the project.

Now I want to use FTGL in my own project, so I added libfreetype.a and libftgl.a to the project. Now I'm not sure what to do with headers? I tried adding the headers from both freetype and ftgl, but when doing include "ftgl.h" it can't find the file, I have tried using include <> and also using include/ftgl.h but I get various different errors, including: include expects <FILENAME> or "filename", and various other errors that I can't quite remember as I'm not at the same computer just now.

If you run make in the freetype directory it will build a static library called libfreetype.a. This file is hidden away and is a bit hard to find. From memory it is in .lib or objs/.lib (guess you found it).

Then you need to point the FTGL project at this library and the freetype includes so that you can build libftgl.a, another static library. This has to be done manually because they could be anywhere.

Then copy both of these libraries into YOUR project and point your project at each of the include directories. You can do this by dragging the directories into your project or by setting up the header paths in the compiler settings. Depending on how you built freetype you may also have to link against libz, but this is a standard library on osx so your don't have to do anything special for this.

Um. Static libraries are designed to be built into the executable, this way the user doesn't have to install anything extra and you don't have to include anything extra in the bundle. Just add the path to the static lib in your linker flags and you should be all set.

I can't get freetype to work.
1. I run make in the freetype folder
2. I run make install in the freetype folder
3. I open my Xcode project and drag libfreetype.a and the the folder freeytpe(from freetype-2.1.9/nclude) into the filelist.
4. I add

Code:

#include <ft2build.h>
#include FT_FREETYPE_H

(I've seen this in a tutorial) to my code
5. I try to compile but it failes.

I seem to be having the same problem as Simon Schoelly above. I have built freetype 2.1.9 in xcode following the INSTALL.ANY file. I put libfreetype.a into my project. When I build everything compiles and then I get a mysterious "build failed" at the end.

I have traced the problem down to zerolink. If I turn off zerolink it builds just fine. For some reason zerolink doesn't want to work with the freetype library. Any insights would be most strongly appreciated.

The only thought I have had so far is - perhaps it's a C and C++ issue. My project is in C++ and freetype is pure C. Perhaps zerolink has trouble with this. But it shouldn't - I don't think.

Anyone who understands something about zerolink please help. It would be annoying to avoid using zerolink for no good reason. Thanks.

I had bad experiences with FTGL when I ran a "make install" on freetype. For me, fixing it involved running a "make uninstall" and then *manually* managing my libs and headers.

For my projects which use freetype and ftgl I have in my project's root folder two folders, lib/ and include/ in which I have symlinks to libfreetype.a and libftgl.a as well as symlinks to the folders containing their respective headers. I'm also using the Open Dynamics Engine and treat its libs and headers the same way.

In Xcode I just tell it to look for headers under include/ and libs under lib/ and I manually drag-n-drop the appropriate libs to the project and tell it not to copy them. I also had to include "-lz" to the linker flags and manually added libz.dylib to my project, since freetype apparently depends on libz.

I did this for the FTGL Xcode project -- to get it to link statically against freetype -- as well as for my own projects.

This builds an executable with no outside dependancies ( of course, none outside of what's normally expected in an OS X app ).

Also, for what it's worth, I've had no problems with zero-link when I do it this way. I think this is because there is *no* ambiguity as to what needs linking and what doesn't.