ubuntu error while loading shared libraries: lib*.so.*: cannot open shared object file

ubuntu中程序编译通过,运行时却报错,
error while loading shared libraries: lib…so: cannot open shared object file: No such file or directory
这和系统默认的动态库搜索路径有关

解决方案,找到对应的动态库(即.so文件路径),如/usr/local/include
然后,在终端运行如下命令

sudo gedit /etc/ld.so.conf

将上述路径写入文件中

include /etc/ld.so.conf.d/*.conf
/usr/local/lib

保存,然后执行下述命令

sudo ldconfig

你可能感兴趣的:(ubuntu,c语言,bug,c++)