How to check if libpng and png++ is installed
Since the above comment by @steeldriver worked for me for the same error, I'm making it an answer so people can easily find it:
In Ubuntu, the development headers and libraries are usually packaged separately from the runtime libraries: in this case you probably need
libpng++-dev
.