解决./exam5-5: error while loading shared libraries: libdemo.so: cannot open shared object file:

来源:互联网 发布:淘宝哪家mcm高仿 编辑:程序博客网 时间:2024/06/09 01:37



在使用动态库的时候,已经生成了可执行文件(exam5-5)了,但是输入./exam5-5运行时报错:

./exam5-5: error while loading shared libraries: libdemo.so: cannot open shared object file: No such file or directory

这是因为运行时系统无法找到你的动态库,这时候要配置一下:

进入/etc/ld.so.conf.d/目录下


新建一个文件:demo.conf(libdemo,so)

然后再demo.conf中写入libdemo.so的路径

我这里是   /home/lan/桌面/GNU C/动态库


最后一root身份输入:/sbin/ldconfig-v

让改成的配置文件生效即可

然后就可以运行啦:

参考:运行错误:error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or


阅读全文
0 0
原创粉丝点击