Webber Webber - 1 year ago 160
C++ Question

Linux C: Reference to non-static member function must be called

error:Reference to non-static member function must be called
Fellow is my codes:

HTTPClient::HTTPClient(int id,HttpListener& message) {
pthread_t thId;
pthread_create(&thId, NULL, processor, this); <--error is here

void* HTTPClient::processor(void* userData) {
HTTPClient* client = static_cast<HTTPClient*>(userData);

void HTTPClient::run() {
while(true) {
httpLoadFile(mUrl, mPath);

I have found some methods try to solve the error, but failed!

Answer Source

It says you cannot pass pointer to method into pthread_create, you should pass pointer to ordinary function.