error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file

Run the compiled demo program, and the error is as follows:

./demo: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

Check whether libpng exists through the command:

ldconfig -p | grep libpng

Solution:

apt-get install libpng16-dev

 

Read More: