The normal way to pass function as arguments in pthreads for pthread_create method is
pthread_create(&thread,NULL,func,(void*)arg)
while func() is declared/defined as
void* func(void* arg);
but whenever I want to call pthread_create it in separate .cpp in visual studio 2012 it gives following error, as shown in the pic
but the error goes away if I define the function static.
static void* func(void* arg);
Any suggestions how to pass it without error without making it static?
The error message says that
AppendData_Linux
is member function ofXMLParse
class, and that can't convert to pointer to normal (non-member) function required bypthread_create
.Here is solution: