Jump to content

  • Log In with Google      Sign In   
  • Create Account

freetype2 linking problems


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 NSDuo   Members   -  Reputation: 270

Like
0Likes
Like

Posted 23 February 2013 - 03:51 PM

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...)


Macbook Pro 2.66Ghz dual core, 4GB ram, 512MB vram, MacOSX 9.1, Windows 8.1
Xcode 5.0.2, C++, lua


Sponsor:

#2 Nercury   Crossbones+   -  Reputation: 774

Like
1Likes
Like

Posted 23 February 2013 - 06:31 PM

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, 23 February 2013 - 06:34 PM.


#3 NSDuo   Members   -  Reputation: 270

Like
0Likes
Like

Posted 23 February 2013 - 11:39 PM

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?


Macbook Pro 2.66Ghz dual core, 4GB ram, 512MB vram, MacOSX 9.1, Windows 8.1
Xcode 5.0.2, C++, lua


#4 NSDuo   Members   -  Reputation: 270

Like
0Likes
Like

Posted 24 February 2013 - 03:23 PM

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, 24 February 2013 - 11:53 PM.

Macbook Pro 2.66Ghz dual core, 4GB ram, 512MB vram, MacOSX 9.1, Windows 8.1
Xcode 5.0.2, C++, lua





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS