Jump to content
  • Advertisement
Sign in to follow this  
NSDuo

freetype2 linking problems

This topic is 2037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement
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.

You have to add compiled "libfreetype.a" to your project's "link libraries" list. It will be linked into final executable. Edited by Nercury

Share this post


Link to post
Share on other sites

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 this post


Link to post
Share on other sites

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.

2: Add "usr/local/include" and "usr/local/include/freetype2" as the framework's header search paths.

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

 

 

EDIT: NOW FIXED

I spoke too soon. Once I started using the library, I got errors saying: "_BZ2_bzdecompress" not found, "_BZ2_bzdecompressEnd" not found, and "_inflate" not found. This was fixed by downloading the "bzip" and "zlib" libraries and including them in my project.

Edited by NSDuo

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!