4

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
mloskot
  • 37,086
  • 11
  • 109
  • 136
Viet
  • 17,944
  • 33
  • 103
  • 135

2 Answers2

30

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
  • 840
  • 1
  • 8
  • 17
  • +1 thanks. I have thought about this but reverted to 1.2 to avoid other problems (if any). – Viet Apr 02 '10 at 16:12
0

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

Viet
  • 17,944
  • 33
  • 103
  • 135