程序编译罚款与升压库,但它运行时错误 [英] Program compiles fine with boost libs, but error when running it
问题描述
简而言之...
C ++程序(使用Boost库)在Eclipse编译良好,但之后错误而载入共享库:libboost_thread.so.1.46.1:无法打开共享对象文件:没有这样的文件或目录运行时,它显示它
详细信息
我正在对C ++的一个基本的程序来检查,我还可以使用升压正确线程库。
的#include<升压/线程/ thread.hpp>
#包括LT&;&iostream的GT;你好无效()
{
标准::法院LT&;<你好,我是一个线程<<的std :: ENDL;
}诠释的main()
{
提高::线程TH1(安培;你好);
th1.join();
}
在code编译好,所以我相信我已经安装并设置了Boost库正确(添加目录包括等)
然而,当我尝试运行该程序我在康寿收到以下错误消息
libboost_thread.so.1.46.1:无法打开共享对象文件:没有这样的文件或目录而载入共享库 错误
我有FreeFileSYnc一个非常类似的问题,编译罚款,但由于不会推出一个libboost线程错误:
FreeFileSync:错误而载入共享库:libboost_thread.so.1.51.0:无法打开共享对象文件:没有这样的文件或目录
要解决它,我所做的:
须藤ldconfig的在/ usr / local / lib目录
它可以帮助其他人。
In a nutshell...
C++ program (using the boost libraries) compiles fine in Eclipse, but then "error while loading shared libraries: libboost_thread.so.1.46.1: cannot open shared object file: No such file or directory" it shown when running it.
Details
I am running a basic program on C++ to check that I can use the boost threading libraries correctly.
#include <boost/thread/thread.hpp>
#include <iostream>
void hello ()
{
Std::cout<<"Hello, I am a thread"<<std::endl;
}
int main ()
{
boost::thread th1(&hello);
th1.join();
}
The code compiles fine, so I believed that I had installed and set up the boost libraries correctly (added directories to include etc)
However when I try to run the program I get the following error message in the consol
error while loading shared libraries: libboost_thread.so.1.46.1: cannot open shared object file: No such file or directory
I had a very similar issue with FreeFileSYnc, compiles fine but won't launch due to a libboost thread error :
FreeFileSync: error while loading shared libraries: libboost_thread.so.1.51.0: cannot open shared object file: No such file or directory
To fix it I did :
sudo ldconfig /usr/local/lib
It may help other people.
这篇关于程序编译罚款与升压库,但它运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!