C语言 加载共享库 libpng16 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25549536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error while loading shared libraries libpng16
提问by Michal Krakovsky
I am trying to compile and run this codeunder ubuntu 14.04. I downloaded and installed libpngversion 1.6.12. I am able to compile the code using gcc test.c -lpngbut 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
我正在尝试在 ubuntu 14.04 下编译和运行此代码。我下载并安装了libpng 1.6.12版。我可以使用以下代码编译代码,gcc test.c -lpng但是当我尝试运行它时,出现此错误:
./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/liband I copied it to /usr/local/include/libpng16/and as well to /usr/local/include/and recompiled the code, anyway the problem still persists.
编辑:
所以我找到了 libpng16.so.16,它在里面/usr/local/lib,我将它复制/usr/local/include/libpng16/到/usr/local/include/并重新编译代码,无论如何问题仍然存在。
Any suggestions ?
有什么建议 ?
采纳答案by Krishan Kumar Mourya
You can download the library from the link https://sourceforge.net/projects/libpng/?source=directory
您可以从链接https://sourceforge.net/projects/libpng/?source=directory下载库
It will download a file something like "libpng-1.6.32.tar.xz"
它会下载一个类似于“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
回答by Michal Krakovsky
回答by MhDG7
I had same problem before I had installed it form below link and problem fixed.
在我从下面的链接安装它之前我遇到了同样的问题并解决了问题。
I hope yours would be fixed as well
我希望你的也能修复

