I\'m using libpng from ubuntu and when I try to compile a c++ file I get
undefined reference to `png_set_longjmp_fn\'
I\'m using libpng version 1.6.8
In my case, I have the old png 1.2 came with my ubuntu installed in /usr. I installed the 1.6.x in /usr/local. In my make system, the default include /usr/include and linking /usr/lib were picked up. When compiling any software that rely on the new interface, you need to add
CPPFLAGS="-I/usr/local/include $CPPFLAGS"
LDFLAGS="-L/usr/local/lib $LDFLAGS"
this will pick up
grep png_set_longjmp_fn png.h
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
(*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
from the newer interface
Perhaps you have built with libpng-1.6.8 but are linking to an earlier version of libpng. The "png_set_longjmp_fn()" API was introduced in libpng-1.4.x. Ubuntu 13:10 currently comes with libpng-1.2.49 (see /usr/include/libpng12), which does not supply png_set_longjmp_fn().
If you do this on an older Playstation Portable program you also might have stale libraries in the source directory. Run rm *.a
then make clean
which happened to fix that error message for me.