Let\'s say I have a class such as
class c {
// ...
void *print(void *){ cout << \"Hello\"; }
}
And then I have a vector of c
My first answer ever in the hope that it'll be usefull to someone : I now this is an old question but I encountered exactly the same error as the above question as I'm writing a TcpServer class and I was trying to use pthreads. I found this question and I understand now why it was happening. I ended up doing this:
#include
method to run threaded -> void* TcpServer::sockethandler(void* lp) {/*code here*/}
and I call it with a lambda -> std::thread( [=] { sockethandler((void*)csock); } ).detach();
that seems a clean approach to me.