Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 19, 2012, 04:17 PM   #1
Eudall
macrumors newbie
 
Join Date: Apr 2011
Freetype2 Problems

Hi All,

I am currently looking at doing some work using the Freetype2 API. I downloaded the latest stable release (2.4.8) from http://freetype.sourceforge.net/index2.html. After the download I untared the bzip tarball and followed the instructions within docs/INSTALL.UNIX to install:

Code:
   ./configure
   make -s
   sudo make -s install
No errors were reported on the terminal, so I assumed everything was ok and wrote a simple test application following advice from the freetype2 tutorial (http://freetype.sourceforge.net/free...ial/step1.html). The application compiles cleanly, however it fails to link. Please see output below:

Code:
Undefined symbols for architecture x86_64:
  "_FT_Init_FreeType", referenced from:
      _ft_init in ccK9n142.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I am compiling the application in the following way:
Code:
   gcc -o ftTest ftTest.c -I/usr/local/include/freetype2 -I/usr/local/include
I have had a look on Google for this problem, but was unable to find anything useful. I have tried adding '-m32' to the compiler options, per a discussion on StackOverflow, but that produced the same error, but stating architecture i386.

For reference, I am using Mac OS X 10.7.2.

Any suggestions would be greatly appreciated.

Thanks

Last edited by Eudall; Jan 20, 2012 at 01:04 PM. Reason: Marking thread as resolved.
Eudall is offline   0 Reply With Quote
Old Jan 19, 2012, 04:28 PM   #2
thundersteele
macrumors 68030
 
Join Date: Oct 2011
Quote:
Originally Posted by Eudall View Post
I am compiling the application in the following way:
Code:
   gcc -o ftTest ftTest.c -I/usr/local/include/freetype2 -I/usr/local/include
Ok, I'm not really an expert, but when I compile C/C++ programs, my workflow is

Code:
gcc -c ftTest.c -o ftTest.o
gcc ftTest.o -LIBRARIES -o ftTest
replace -LIBRARIES with your above lib paths.
thundersteele is offline   0 Reply With Quote
Old Jan 19, 2012, 04:41 PM   #3
Eudall
Thread Starter
macrumors newbie
 
Join Date: Apr 2011
Quote:
Originally Posted by thundersteele View Post
Ok, I'm not really an expert, but when I compile C/C++ programs, my workflow is

Code:
gcc -c ftTest.c -o ftTest.o
gcc ftTest.o -LIBRARIES -o ftTest
replace -LIBRARIES with your above lib paths.
Hi,

Thanks for the fast response, the gcc line I am using provides the same result as yours, but you simply build objects and link these. I double checked using your suggestion, but this provides the same error.

Thanks
Eudall is offline   0 Reply With Quote
Old Jan 20, 2012, 01:05 AM   #4
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Quote:
Originally Posted by Eudall View Post
I am compiling the application in the following way:
Code:
   gcc -o ftTest ftTest.c -I/usr/local/include/freetype2 -I/usr/local/include
You've specified where to find the include files, that's good and is why you can compile. But you haven't told gcc to actually link to the freetype2 library. You'll need a -L option and -l (lowercase) option to successfully link. The -L option tells gcc where to find libraries. The -l option specifies a library to actually link against.

Try this:
Code:
gcc -I/usr/local/include/freetype2 -I/usr/local/include -L/usr/local/lib -lfreetype -o ftTest ftTest.c
jiminaus is offline   1 Reply With Quote
Old Jan 20, 2012, 11:08 AM   #5
Eudall
Thread Starter
macrumors newbie
 
Join Date: Apr 2011
Quote:
Originally Posted by jiminaus View Post
You've specified where to find the include files, that's good and is why you can compile. But you haven't told gcc to actually link to the freetype2 library. You'll need a -L option and -l (lowercase) option to successfully link. The -L option tells gcc where to find libraries. The -l option specifies a library to actually link against.

Try this:
Code:
gcc -I/usr/local/include/freetype2 -I/usr/local/include -L/usr/local/lib -lfreetype -o ftTest ftTest.c
Damn, I knew I had forgot something. Thanks
Eudall is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
HELP! Sync problem!? Kman07 iPod touch Hacks 0 Nov 11, 2010 09:56 PM
A Font Problem RobertsonDesign Mac Basics and Help 3 Nov 7, 2010 06:30 PM
Macbook pro 15" i7 problems, need some help. filfortugno MacBook Pro 1 Nov 7, 2010 05:44 PM
Major AppleTV (2010) problems all of a sudden. iMJustAGuy Apple TV and Home Theater 6 Nov 6, 2010 08:57 AM
2007 Macbook wifi connection problems jwbradle MacBook 2 Nov 3, 2010 01:35 PM


All times are GMT -5. The time now is 10:24 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC