Try just changing the sequence of parameters in your g++
call and have -lpng
behind the object files. The linker evalueates the arguments in the sequence they are given so when it gets -lpng
it has not yet knowledge of io_png.o
and so it doesn't link the neccessary code from the library
Edit:
The last command of what your makefile executes is:
g++ -lpng -lm -fopenmp -L/opt/local/lib/ -L/usr/local/lib/ -L/usr/lib/ -L/usr/lib/x86_64-linux-gnu/ -fopenmp -lpng -lpngwriter -lz -lfreetype -o nlmeans_ipol nlmeans_ipol.o io_png.o libauxiliar.o libdenoising.o mt19937ar.o
If should be something like
g++ -L/opt/local/lib/ -L/usr/local/lib/ -L/usr/lib/ -L/usr/lib/x86_64-linux-gnu/ -o nlmeans_ipol nlmeans_ipol.o io_png.o libauxiliar.o libdenoising.o mt19937ar.o -lpng -lm -fopenmp -lpngwriter -lz -lfreetype
I don't know each of the libraries, maybe the sequence of the -l...
parameters still isn't right