title: error linking to LibPng library
body: <p>I am having trouble linking to the libpng library.
  The build seems unable to define references to Libpng calls.
  I think the problem is in my Libpng install.</p>
  
  <p>I am runing in the Mingw environment on a Win7 laptop
  My build environment is as follows:</p>
  
  <pre><code>My path starts with C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\git\cmd;C:\Program Files 
  
  
  C:\Users\Bob\Home\png23d&gt;g++ --version
  g++ (GCC) 5.3.0
  
  I have built and installed libpng-1.6.28 which creates the following:
  C:\MinGW\bin&gt;
      libpng-config
      libpng16-config
      libpng16.dll
  
  C:\MinGW\include\libpng
      png.h
      pngconf.h
      pnglibconf.h
  
  C:\MinGW\include\libpng16
      png.h
      pngconf.h
      pnglibconf.h
  
  C:\MinGW\lib\pkgconfig
  
  C:\MinGW\lib&gt;
      libpng.a
      libpng.dll.a
      libpng16.a
      libpng16.dll.a
  
  a symbolic link `libpng' to `libpng16'
  a symbolic link `libpng.pc' to `libpng16.pc'
  a symbolic link `libpng.a' to `libpng16.a'
  a symbolic link `libpng-config' to `libpng16-config 
  </code></pre>
  
  <p>when I try to build a program "png23d" I get the following</p>
  
  <pre><code>C:\Users\Bob\Home\png23d&gt;make
  g++ -DUSE_LIBPNG -lpng  png23d.o option.o bitmap.o mesh.o mesh_gen.o mesh_index.o mesh_simplify.o out_pgm.o out_rscad.o out_pscad.o out_stl.o   -o png23d
  
  bitmap.o:bitmap.c:(.text+0x102): undefined reference to `png_sig_cmp'
  bitmap.o:bitmap.c:(.text+0x142): undefined reference to `png_create_read_struct'
       .
       .
       .
  bitmap.o:bitmap.c:(.text+0x418): undefined reference to `png_read_end'
  bitmap.o:bitmap.c:(.text+0x466): undefined reference to `png_destroy_read_struct'
  collect2.exe: error: ld returned 1 exit status
  &lt;builtin&gt;: recipe for target 'png23d' failed
  make: *** [png23d] Error 1
  </code></pre>
  
  <p>I am almost sure its the -lpng that is not working.... I am just don't know how to fix it.
  I am guessing that it is a symbolic link problem and I know I did not create one during the libpng build.
  If I am right what do I need to link it to.</p>
  
  <p>I tried changing -lpng to -llpng16. It made no difference.</p>
  
  <p>Thanks from the command prompt that work fine.
  just have to figure out how to change the make file.</p>
  
  <pre><code>#!/usr/bin/make
  #
  # png23d is a program to convert png images into 3d files
  #
  # Copyright 2011 Vincent Sanders &lt;vince@kyllikki.org&gt;
  #
  # Released under the MIT License, 
  #   http://www.opensource.org/licenses/mit-license.php
  
  CC = g++
  
  VERSION=100
  
  PREFIX = 
  
  WARNFLAGS = -W -Wall -Wundef -Wpointer-arith \
          -Wcast-align -Wwrite-strings -Wstrict-prototypes \
          -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
          -Wnested-externs
  ifneq ($(GCCVER),2)
    WARNFLAGS += -Wno-unused-parameter 
  endif
  
  OPTFLAGS=-O2
  #OPTFLAGS=-O0
  
  CFLAGS+=$(WARNFLAGS) -MMD -DVERSION=$(VERSION) $(OPTFLAGS) -g
  
  LDFLAGS+= -DUSE_LIBPNG -lpng
  
  PNG23D_OBJ=png23d.o option.o bitmap.o mesh.o mesh_gen.o mesh_index.o mesh_simplify.o out_pgm.o out_rscad.o out_pscad.o out_stl.o
  
  .PHONY : all clean
  
  all:png23d
  
  png23d:$(PNG23D_OBJ)
  
  -include $(PNG23D_OBJ:.o=.d)
  
  -include test/Makefile.sub
  
  clean: testclean
      ${RM} png23d $(PNG23D_OBJ) *.d *~ png23d.png
  
  install:png23d
      install -D png23d $(DESTDIR)$(PREFIX)/bin
  
  install-man:png23d.1
      install -D png23d.1 $(DESTDIR)$(PREFIX)/share/man/man1
  
  # logo creation
  png23d.png:png23d.pov
      povray +L/usr/share/povray/include/ -D +Q11 +O$@ +UV +UL +A0.2 +FP8 +W400 +H300 $&lt;
  </code></pre>