Statically linking to libjpeg?
Hey, I want to use libjpeg in my program, but I don't think I'm linking to it correctly.
I've built it like this:
I then go to /usr/local/lib and add the libjpeg.a file to my project. Next I add the jpeglib.h, jconfig.h, and jmorecgf.h to my project. I #include "jpeglib.h", and that's it. Have I done something wrong (possibly producing the .a lib file)? I know it's something to do with not including libjpeg correctly, as I've done this before when forgetting to include a header file for OpenGL.
Thanks!
Btw, my errors were:
I've built it like this:
Code:
ln -s `which glibtool` ./libtool
./configure --enable-shared --enable-static
make
sudo make installI then go to /usr/local/lib and add the libjpeg.a file to my project. Next I add the jpeglib.h, jconfig.h, and jmorecgf.h to my project. I #include "jpeglib.h", and that's it. Have I done something wrong (possibly producing the .a lib file)? I know it's something to do with not including libjpeg correctly, as I've done this before when forgetting to include a header file for OpenGL.
Thanks!
Btw, my errors were:
Code:
Undefined symbols:
...
...all libjpeg functions I used...
...
... all .o files they are used in...
...
Are you trying to build a universal binary?
You should usually use --disable-shared, btw.
You should usually use --disable-shared, btw.
I'm not sure it is a universal built... I don't know how to tell when building from the terminal. I'll try rebuilding from without the --enable-shared
I didn't mean your libjpeg was universal (it's not). I meant if the application you're trying to build *using* libjpeg is universal, which won't work.
Actually, no. It was set to "Current Mac OS" as the target, which I had not realized it was. Just out of curiosity I changed it to 10.4 universal target, and then I had got errors for GLFW. It couldn't find the headers I installed at /usr/local/include/GL
So, I may have to target something else (Is that universal though, I have Tiger)?
Edit - I found this on the web.
Would this build the lib correctly, then linking with it would work?
Code:
#include <GL/glfw.h>So, I may have to target something else (Is that universal though, I have Tiger)?
Edit - I found this on the web.
Code:
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar xvfz jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure
make
sudo make install-lib
sudo ranlib /usr/local/lib/libjpeg.a
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Help With libjpeg | spinner | 2 | 2,640 |
Oct 4, 2006 08:17 PM Last Post: akb825 |
|

