Incompatible libpng warning (errors) at runtime
Alec Jacobson
September 05, 2012
Using Yotam's YImage library I ran into a problem at runtime:
libpng warning: Application was compiled with png.h from libpng-1.5.4
libpng warning: Application is running with png.c from libpng-1.4.12
libpng warning: Incompatible libpng version in application and library
libpng encountered a problem writing ...png
Turns out the culprit was which png library g++ was finding at the time I compiled the YImage library and the one I was linking my program too. To make it work I replaced:
-lpng
with
-L/usr/X11/lib -lpng
which ensures that I'm linking to the libpng that belongs to X11, which is for some reason what YImage uses.