Michal Krakovsky
Michal Krakovsky

Reputation: 797

error while loading shared libraries libpng16

I am trying to compile and run this code under ubuntu 14.04. I downloaded and installed libpng version 1.6.12. I am able to compile the code using gcc test.c -lpng but when I try to run it, I get this error: ./a.out: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

edit:
So I found libpng16.so.16, it was in /usr/local/lib and I copied it to /usr/local/include/libpng16/ and as well to /usr/local/include/ and recompiled the code, anyway the problem still persists.

Any suggestions ?

Upvotes: 23

Views: 38003

Answers (3)

Krishan Kumar Mourya
Krishan Kumar Mourya

Reputation: 2306

You can download the library from the link https://sourceforge.net/projects/libpng/?source=directory

It will download a file something like "libpng-1.6.32.tar.xz"

Simply extract the file go inside folder and run these commands to install

./configure
make check
make install

Then you need to run after installing any library

ldconfig

Upvotes: 13

Michal Krakovsky
Michal Krakovsky

Reputation: 797

Ok so I found the solution here. The trick is to run sudo ldconfig after you install some shared library.

Upvotes: 33

Mehdi Golzadeh
Mehdi Golzadeh

Reputation: 2583

I had same problem before I had installed it form below link and problem fixed.

I hope yours would be fixed as well

PNG reference library: libpng

Upvotes: 1

Related Questions