I
iceman
Hi all,
I am trying to create a thread in one of the methods of the class but
this errors keeps throwing up
I create the thread with
pthread_create (&thread_id, NULL, &print_xs, NULL);
Then I get the error
AppClass.cpp:78: error: ISO C++ forbids taking the address of an
unqualified or bracketed non-static member function to form a pointer
to member function. Say '&AppClass:rint_xs'
AppClass.cpp:78: error: cannot convert 'void* (AppClass::*)(void*)' to
'void* (*)(void*)' for argument '3' to 'int pthread_create(pthread_t*,
const pthread_attr_t*, void* (*)(void*), void*)'
But is I say
pthread_create (&thread_id, NULL, &print_xs, NULL);
I get the error
AppClass.cpp:78: error: cannot convert 'void* (AppClass::*)(void*)' to
'void* (*)(void*)' for argument '3' to 'int pthread_create(pthread_t*,
const pthread_attr_t*, void* (*)(void*), void*)'
How can I solve this without making print_xs static?
Cheers
I am trying to create a thread in one of the methods of the class but
this errors keeps throwing up
I create the thread with
pthread_create (&thread_id, NULL, &print_xs, NULL);
Then I get the error
AppClass.cpp:78: error: ISO C++ forbids taking the address of an
unqualified or bracketed non-static member function to form a pointer
to member function. Say '&AppClass:rint_xs'
AppClass.cpp:78: error: cannot convert 'void* (AppClass::*)(void*)' to
'void* (*)(void*)' for argument '3' to 'int pthread_create(pthread_t*,
const pthread_attr_t*, void* (*)(void*), void*)'
But is I say
pthread_create (&thread_id, NULL, &print_xs, NULL);
I get the error
AppClass.cpp:78: error: cannot convert 'void* (AppClass::*)(void*)' to
'void* (*)(void*)' for argument '3' to 'int pthread_create(pthread_t*,
const pthread_attr_t*, void* (*)(void*), void*)'
How can I solve this without making print_xs static?
Cheers