I am trying to run the following program using 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;
}
It is throwing an error while compiling as given below:
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)
I am using boost 1.42. I have also tried old style boost::thread creation.
When hello() is not a class function, everything goes fine. Please let me know how can I fix it?