我是C++的新手,如果能指出可能存在的問題,將不勝感激。我正在嘗試使用調用函數的boost線程。我編輯了工作代碼來介紹線程。在受保護的方法內提升線程功能
在.H我在.cpp文件中有
class Base: public test
{
public:
Base(string Name, string test);
virtual ~Base();
Base &operator=(const Base &other);
Base(const Base &other);
protected:
virtual void Run();
private:
void RunBasic();
void workerFunc();
}
我
void Base::Run()
{
boost::thread workerThread(workerFunc);
RunBasic();
workerThread.join();
}
void Base::workerFunc()
{
#pretending to do some work
#some functionality here
}
void Base::RunBasic()
{
#more stuff here
}
我得到一個編譯錯誤error: no matching function for call to ‘boost::thread::thread(<unresolved overloaded function type>)’
非常感謝你們。 – user2137735 2013-03-06 18:02:08