2

Open() だから私はブーストスレッドでメンバー関数を開始したい:

.hpp

Class MyClass{
  public:
    int Open();
  private:
    void handle_thread();
};

.cpp

int MyClass::Open(){
    boost::thread t(handle_thread);
    t.join();
    return 0;
}

void MyClass::handle_thread(){
  //do stuff
}

test.cpp
int main(){
     MyClass* testObject = new MyClass()
     testObject.Open();
}

これにより、コンパイラ エラーが発生します。

error: no matching function for call to 'boost::thread::thread(<unresolved overloaded function type>)'

Open() は、handle_thread を呼び出すオブジェクトを認識していません。しかし、正しい構文が何であるかを理解できません。

4

1 に答える 1