boost编译应用程序上的.dll错误
简单的应用程序,只是学习设置我的boost环境 程序已编译,但我得到一个libboost_线程-mgw44-mt-1_51.dll丢失错误 另一方面,我不得不将thread1.stop()改为t1.stop(),因为boost说stop()没有函数 我有dll,将dll放在与应用程序相同的文件夹中不会做任何事情boost编译应用程序上的.dll错误,boost,dll,compilation,Boost,Dll,Compilation,简单的应用程序,只是学习设置我的boost环境 程序已编译,但我得到一个libboost_线程-mgw44-mt-1_51.dll丢失错误 另一方面,我不得不将thread1.stop()改为t1.stop(),因为boost说stop()没有函数 我有dll,将dll放在与应用程序相同的文件夹中不会做任何事情 #include <boost/bind.hpp> #include <boost/thread.hpp> class Threadable { publi
#include <boost/bind.hpp>
#include <boost/thread.hpp>
class Threadable
{
public:
void stop()
{
running = false;
}
int run()
{
running = true;
while(running)
{
//Do Something Meaningful
}
return 0;
}
private:
bool running;
};
int main()
{
Threadable t1, t2;
boost::thread thread1(boost::bind(&Threadable::run, t1));
boost::thread thread2(boost::bind(&Threadable::run, t2));
// Let the threads run for half a second
boost::this_thread::sleep(boost::posix_time::milliseconds(500));
// Signal them to stop
t1.stop();
t2.stop();
//thread1.stop();
//thread2.stop();
// Wait for them to gracefully exit
thread1.join();
thread2.join();
return 0;
}
#包括
#包括
类螺纹
{
公众:
无效停止()
{
运行=错误;
}
int运行()
{
运行=真;
(跑步时)
{
//做些有意义的事
}
返回0;
}
私人:
布尔跑;
};
int main()
{
可穿t1,t2;
boost::thread1(boost::bind(&Threadable::run,t1));
boost::thread2(boost::bind(&Threadable::run,t2));
//让线程运行半秒钟
boost::this_线程::sleep(boost::posix_时间::毫秒(500));
//向他们发出停止的信号
t1.停止();
t2.停止();
//thread1.stop();
//螺纹2.停止();
//等待他们优雅地退出
thread1.join();
螺纹2.连接();
返回0;
}
您的路径上需要libboost_thread-mgw44-mt-1_51.dll-您在te boost build的任何地方都有该文件吗?是的。我提到我将请求的dll放在应用程序路径中,我还向我添加了lib系统路径env-vat