views:

756

answers:

2

Hi, I always get this error when trying to compile my file with Boost::GIL PNG IO support:

(I'm running Mac OS X Leopard and Boost 1.42, LibPNG 1.4)

/usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_reader::init()':
/usr/local/include/boost/gil/extension/io/png_io_private.hpp:155: error: 'png_infopp_NULL' was not declared in this scope
/usr/local/include/boost/gil/extension/io/png_io_private.hpp:160: error: 'png_infopp_NULL' was not declared in this scope
/usr/local/include/boost/gil/extension/io/png_io_private.hpp: In destructor 'boost::gil::detail::png_reader::~png_reader()':
/usr/local/include/boost/gil/extension/io/png_io_private.hpp:174: error: 'png_infopp_NULL' was not declared in this scope
/usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_reader::apply(const View&)':
/usr/local/include/boost/gil/extension/io/png_io_private.hpp:186: error: 'int_p_NULL' was not declared in this scope
/usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_reader_color_convert<CC>::apply(const View&)':
/usr/local/include/boost/gil/extension/io/png_io_private.hpp:228: error: 'int_p_NULL' was not declared in this scope
/usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_writer::init()':
/usr/local/include/boost/gil/extension/io/png_io_private.hpp:317: error: 'png_infopp_NULL' was not declared in this scope
A: 

Initially I used libpng 1.4. I switched to version 1.2 and all the problems went away.

Viet
+5  A: 

libpng 1.4 dropped definitions of png_infopp_NULL and int_p_NULL. So add

#define png_infopp_NULL (png_infopp)NULL
#define int_p_NULL (int*)NULL

in your code before including GIL headers.

wdscxsj
+1 thanks. I have thought about this but reverted to 1.2 to avoid other problems (if any).
Viet