boost编译应用程序的.dll错误

时间:2012-10-12 14:20:44

标签: boost dll compilation

简单的应用程序,只是学习设置我的提升环境......

程序编译,但我得到一个libboost_thread-mgw44-mt-1_51.dll缺少错误

在旁注中,我不得不将thread1.stop()更改为t1.stop(),因为boost表示没有stop()函数。

我有dll,将dll放在同一文件夹中,因为应用程序没有做任何事情。

#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;
}

0 个答案:

没有答案