+ 5
Threads in C++
Hi, I'm coding some server stuff and I wan't to spawn some threads for handling user connections. But when I try to spawn a thread I get an error. Can somebody tell me what's wrong?? Here's the full Server headers file: https://code.sololearn.com/cwtQmhvgl77u/#cpp And the piece of code in which the error occurs: https://code.sololearn.com/c688xq5wiM54/#cpp (The error msg is in there) Thank you in advance :)
2 Answers
0
Your error message Server.cpp:57:49: error: invalid use of non-static member function âvoid Server::Botnet::listenToInfected(int, sockaddr_in)â
Botnet::listenToInfected is not a static member function so you must pass the instance as 2nd argument
e.g.
std::thread listenToInfectedThread (&Botnet::listenToInfected, myInstance, server_fd, serv_address);
0
@Worm this is completly wrong not sure who has voted this up ...