problem with linking with libjpeg

Posts: 3
Joined: 2008.10
Post: #1
Hi there,

I'm using libjpeg 6b ( installed to /usr/local/ ) in my project to load images for texturing. When building everything works fine (compiling) until linking occurs. I get a "symbol(s) not found" error for every libjpeg function I use. I can't find an explanation on this. I'm using Xcode 3.1 on Mac Os X 10.5.5, have set the /usr/local/lib/ library search directory in build settings, my code is written in Objective C and I include libjpeg this way:

#include <jpeglib.h>

Any help would be appreciated Smile
Greetings, Alex.
Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #2
You didn't mention anything about passing -ljpeg to gcc, so I'm guessing that's the step you're missing. However, if your project is going to link against libjpeg, I'd strongly recommend keeping everything libjpeg-related contained inside your project rather than installing it on your system. If you rely on an installation, that means you'll have to install libjpeg on every development computer you want to use to compile your project. Worse yet, if you accidentally link dynamically (surprisingly easy to do!), your app will work fine on your computer, but crash on startup for anyone who runs it on a computer without the appropriate libraries installed. Keeping all of your headers and libraries within your project directory and ensuring that you're linking statically (or at least bundling dynamically-linked libraries appropriately) solves both of these problems.
Quote this message in a reply
Posts: 3
Joined: 2008.10
Post: #3
Thanks for the hint. I'll have a look at the correct usage of libraries. I haven't worked with many yet. You were right about the -ljpeg flag. I thought that passing the "/usr/local/lib/" path to xcode in "library search path" would be sufficient so I'll have to learn how to use the Tools I'm developing with correctly.
Sorry for posting in the wrong Forum. That should have been in Tools & Technology I guess. Anyway, thank you.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Problem linking GLSL Ilyasim 4 4,597 Dec 18, 2007 12:46 PM
Last Post: OneSadCookie
  openal linking problem on vc++ express 2005 abousoft 1 5,078 Jan 1, 2007 03:55 AM
Last Post: sealfin
  Linking problem macboy 2 3,005 Jul 13, 2003 09:08 AM
Last Post: macboy