在linux下编译程序可能会出现:error while loading shared libraries:xxx.so.0: cannot open shared object file: No such file or directory.这样的错误提示。表示系统不知道xxx.so.0(so表示共享库和windows下的动态链接库相似)文件放在哪个目录。这时,我们需要配置一下/etc/ld.so.conf文件。
因为很多xxx.so.0文件会出现在/usr/local/lib下,所以我们在/etc/ld.so.conf文件中加入语句/usr/local/lib即可。保存后,再运行一下/sbin/ldconfig命令才会起作用。