+ 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 :)

3rd Apr 2018, 10:08 AM
L00P3R
L00P3R - avatar
2 Respuestas
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);
3rd Apr 2018, 1:03 PM
---
--- - avatar
0
@Worm this is completly wrong not sure who has voted this up ...
5th Apr 2018, 7:30 PM
---
--- - avatar