libpng “png_set_longjmp_fn” not found

耗尽温柔 提交于 2019-12-01 16:04:28

问题


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

If you are interested in reading the code please let me know, but I do not this has to do with my bad code.

Thank you in advance.


回答1:


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().




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/21545076/libpng-png-set-longjmp-fn-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!