boost :: threadを使って次のプログラムを実行しようとしています。boost :: threadコンパイルエラー
#include <boost/thread.hpp>
#include <iostream>
using namespace std;
class test{
public:
void hello(int i)
{
cout << i << " ";
};
};
int main(int argc, char* argv[])
{
class test t;
boost::thread thrd(t.hello, 10);
thrd.join();
return 0;
}
下記のようにコンパイルしながら、エラーを投げている:
thread.c:17:33: error: no matching function for call to 'boost::thread::thread(, int)' /usr/include/boost/thread/detail/thread.hpp:236:9: note: candidates are: boost::thread::thread(F, A1) [with F = void (test::*)(int), A1 = int] /usr/include/boost/thread/detail/thread.hpp:202:9: note:
boost::thread::thread(boost::detail::thread_move_t)
私はブースト1.42を使用しています。私も古いスタイルのboost :: threadの作成を試みました。
hello()がクラス関数ではない場合、すべて正常になります。どうすれば修正できるのか教えてください。
最初の提案作業...答えに感謝します。 –
@AkashAgrawalええ、それは私の方法で動作し、ちょうど1.42は昔のような、サービス兄弟になることがうれしいです。 – 111111