
Ohh sorry i didnt know that. Thanks all for the help! 2009/3/12 Herve Bronnimann <hervebronnimann@mac.com>
You're taking the address of a member function, which is a different type than what is expected.
But fundamentally, this is not the appropriate mailing list. Try the boost users mailing list.
Sent from my iPhone
On Mar 12, 2009, at 12:00 PM, Filip Klasson <filkl784@student.liu.se> wrote:
Hi,
I have problems creating a thread. This is an example i found:
#include <boost/thread/thread.hpp> #include <iostream>
void hello() { std::cout << "Hello world, I'm a thread!" << std::endl; }
int main(int argc, char* argv[]) {
boost::thread thrd(&hello);
thrd.join();
return 0;
} What if i want to create a thread outside of main (in a class) like this: "myClass.h"
class MyClass { public: hello(); myFunction(); };
"myClass.cpp" MyClass::hello() { std::cout << "Hello world, I'm a thread!" << std::endl; }
MyClass::myFunction() { boost::thread thrd(&hello); thrd.join(); }
This does not work and i get the compile error: '&' : illegal operation on bound member function expression _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost