title: Reading a PNG image with Boost + libpng
body: <p>I am trying to write a simple program that would read in a grayscale PNG image using Boost's GIL Image I/O library and then obtain each pixel's information. I have downloaded and extracted the libpng and zlib, included them in my makefile, and linked them.</p>
  
  <p>When trying to execute the following code:</p>
  
  <pre><code>#include &lt;boost/gil/gil_all.hpp&gt;
  #include &lt;boost/gil/extension/io/png_dynamic_io.hpp&gt;
  #include &lt;iostream&gt;
  
  int main()
  {
      using std::cout;
      using std::endl;
      boost::gil::gray16_image_t image;
      cout &lt;&lt; "TEST";
      boost::gil::png_read_and_convert_image("png16_example.png", image);
      cout &lt;&lt; "test";
      return 0;
  }
  </code></pre>
  
  <p>Neither of the "test" print statements work. In fact, nothing happens at all. I commented out the line:</p>
  
  <pre><code>boost::gil::png_read_and_convert_image("png16_example.png", image);
  </code></pre>
  
  <p>And it runs fine again. I'm not sure what I am doing wrong, as it seems like I've included and linked everything correctly. </p>
  
  <p>Also, if anyone knows of an easier/better way to load in a PNG, I'm also open for suggestions.</p>