加载 boost 共享库时出错 [英] Error loading shared libraries of boost

查看:23
本文介绍了加载 boost 共享库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 centos.我在我的系统上安装了 boost 版本 1.45.0.程序编译正确,但每当我输入命令查看输出时,它都会出现以下错误:

I am working on centos. I installed boost version 1.45.0 on my system. The programs are compiled correctly but whenever I type command to see output it gives following error:

./a.out: 加载共享库时出错:libboost_thread.so.1.45.0:无法打开共享对象文件:没有这样的文件或目录

./a.out: error while loading shared libraries: libboost_thread.so.1.45.0: cannot open shared object file: No such file or directory

推荐答案

您是如何安装 boost 库的?

How did you install the boost libraries?

您可能遇到的问题是链接器找不到库,并且在构建程序时,您必须手动指定其他库路径来搜索库.

The problem you're likely having is that the linker can not find the libraries, and when you built your program, you had to manually specify additional library paths to search for libraries.

您可以做的快速修复是设置 LD_LIBRARY_PATH 以包含 boost 线程库所在的目录:

A quick fix you can do is to set LD_LIBRARY_PATH to include the directory where the boost thread library is:

导出 LD_LIBRARY_PATH=/path/to/boost/libs:$LD_LIBRARY_PATH

./runExecutable

这篇关于加载 boost 共享库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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