加载共享库时出错:libboost_iostreams.so.1.59.0:无法打开共享对象文件:没有这样的文件或目录

Error while loading shared libraries: libboost_iostreams.so.1.59.0: cannot open shared object file: No such file or directory

我正在 运行在 ubuntu 上安装 C++ 可执行文件。可执行文件链接到一些 boost 库。

这是我尝试 运行 二进制文件时的输出:

Error while loading shared libraries: libboost_iostreams.so.1.59.0: cannot open shared object file: No such file or directory

我应该采取什么粗略的行动来消除这个错误。

让我们假设您的库存在但不在标准路径中,并且您在 运行 二进制文件时遇到此错误。在这种情况下,您可以尝试将 LD_LIBRARY_PATH 环境变量设置为指向库所在的目录。然后加载程序将在给定路径中搜索库。

export LD_LIBRARY_PATH=/path/to/my/library
./run_my_binary