jpeg library


this does not really have to do with OpenGL but i have not found useful information anywhere else…

I am working on a Linux OpenGL application and i am trying to use .jpeg as file format for the texture maps… but libjpeg does not seem to work together with c++. My little test application works fine as “jpegest.c” compiled with “gcc jpegtest.c -ljpeg”, but renamed as “jpegtest.C” (and compiled the same way), the linking of the jpeg-library does not seem to work, I receive a lot of “undefined reference”-errors.

Does anybody know about this? Also, it would be interesting to find about using ohter file formats (e.g. .gif) for texture maps.

Kind regards,

You need

extern "C" {
#include <jpeglib.h>

(or whatever the header is called).

You don’t want to go near GIF (patents). libPNG is nearly as easy as libJPEG.

Thanks a lot,

that NEARLY solved the problem… however, one error remains, quite a strange one:

gcc jpegtest.C -ljpeg

…undefined reference to ‘__gxx_personality_v0’

(or something very close to that ).

You need to compile with the g++ (or c++) command, or link with libstdc++.a (pass -lstdc++ on the command-line).

it works thx

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.