I was previously using a void*
function as the third parameter of pthread_create
, and here is what it looked like:
void* nameChange(void*){ ... }
...
pthread_t id;
pthread_create(&id, NULL, nameChange, NULL);
This worked. But I have made some changes to my code and need the function nameChange
to be a member of my class MainWindow
. Here's the only difference now:
void* MainWindow::nameChange(void*)
Now, I get an error when putting nameChange
as the parameter. Here's what it says:
error: cannot convert 'MainWindow::nameChange' from type 'void* (MainWindow::)(void*)' to type 'void* (*)(void*)'
What is it that I am doing wrong here? I'm pretty new to threads, so any help is appreciated!