title: How to install libpng correctly?
body: <p>I am trying to access png pixel data in my C code on. I found this library <a href="http://www.libpng.org/pub/png/libpng.html" rel="nofollow noreferrer">libpng</a>. I downloaded latest version from this site, I am using Ubuntu 14.04. I followed the instructions in the INSTALL file. Everything went well. And then I tried to compile with gcc this piece of <a href="http://zarb.org/~gc/html/libpng.html" rel="nofollow noreferrer">code</a>. But I received this:</p>
  
  <pre><code>/tmp/ccWa9LDO.o: In function `read_png_file':
  test.c:(.text+0x13c): undefined reference to `png_sig_cmp'
  test.c:(.text+0x16f): undefined reference to `png_create_read_struct'
  test.c:(.text+0x1a0): undefined reference to `png_create_info_struct'
  test.c:(.text+0x1db): undefined reference to `png_set_longjmp_fn'
  test.c:(.text+0x20c): undefined reference to `png_init_io'
  test.c:(.text+0x220): undefined reference to `png_set_sig_bytes'
  test.c:(.text+0x239): undefined reference to `png_read_info'
  test.c:(.text+0x252): undefined reference to `png_get_image_width'
  test.c:(.text+0x271): undefined reference to `png_get_image_height'
  test.c:(.text+0x290): undefined reference to `png_get_color_type'
  test.c:(.text+0x2af): undefined reference to `png_get_bit_depth'
  test.c:(.text+0x2c4): undefined reference to `png_set_interlace_handling'
  test.c:(.text+0x2e3): undefined reference to `png_read_update_info'
  test.c:(.text+0x2fc): undefined reference to `png_set_longjmp_fn'
  test.c:(.text+0x36f): undefined reference to `png_get_rowbytes'
  test.c:(.text+0x3b2): undefined reference to `png_read_image'
  /tmp/ccWa9LDO.o: In function `write_png_file':
  test.c:(.text+0x430): undefined reference to `png_create_write_struct'
  test.c:(.text+0x461): undefined reference to `png_create_info_struct'
  test.c:(.text+0x49c): undefined reference to `png_set_longjmp_fn'
  test.c:(.text+0x4cd): undefined reference to `png_init_io'
  test.c:(.text+0x4e6): undefined reference to `png_set_longjmp_fn'
  test.c:(.text+0x559): undefined reference to `png_set_IHDR'
  test.c:(.text+0x572): undefined reference to `png_write_info'
  test.c:(.text+0x58b): undefined reference to `png_set_longjmp_fn'
  test.c:(.text+0x5bf): undefined reference to `png_write_image'
  test.c:(.text+0x5d8): undefined reference to `png_set_longjmp_fn'
  test.c:(.text+0x607): undefined reference to `png_write_end'
  /tmp/ccWa9LDO.o: In function `process_file':
  test.c:(.text+0x692): undefined reference to `png_get_color_type'
  test.c:(.text+0x6be): undefined reference to `png_get_color_type'
  test.c:(.text+0x6db): undefined reference to `png_get_color_type'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I don't understand it because I would expect that if there is problem with installation I would get errors just for including <code>png.h</code>.</p>