编译的C ++程序引发“不能打开共享对象文件”在另一个系统上,虽然文件存在 [英] Compiled C++ program raises "cannot open shared object file" on another system though the file is present

查看:183
本文介绍了编译的C ++程序引发“不能打开共享对象文件”在另一个系统上,虽然文件存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个小程序,需要一些库,包括libboost_filesystem,libboost_program_options和libcurl。

I wrote a tiny program that requires some libraries including libboost_filesystem, libboost_program_options and libcurl.

我在家用机器上编译它,测试它。但是当我尝试启动程序时,它给出以下错误消息:

I compiled it on my home machine and took the binary to my computer at work to test it there. But there it gives the following error message when I try to start the program:

error while loading shared libraries:
libboost_filesystem.so.1.42.0: cannot
open shared object file

对于这个文件,我看到它存在于:
/usr/lib/libboost_filesystem.so.1.42.0

But when I search for this file I see that it exists in: /usr/lib/libboost_filesystem.so.1.42.0

编译/链接期间发生错误的我的程序?

Did I something wrong during the compilation / linking of my program? If yes what do I have to do to make it work on other machines?

推荐答案

首先,尝试发出 ldconfig -p |

First, try to issue ldconfig -p | grep libboost_filesystem.so in a console to make sure the library is in your ld cache.

如果不是,您可能需要在控制台中添加grep libboost_filesystem.so 一个名为 boost.conf 的文件到您的 /etc/ld.so.conf.d 目录。此文件应包含升级库的路径。然后运行 sudo ldconfig 更新系统的ld缓存。

If it is not, you may need to add a file with a name like boost.conf to your /etc/ld.so.conf.d directory. This file should contain a path to your boost libraries. Then run sudo ldconfig to update your system's ld cache.

希望这将有助于...

Hope this will help...

这篇关于编译的C ++程序引发“不能打开共享对象文件”在另一个系统上,虽然文件存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆