How to implement posix threads in linux c++.The smme program when saved as ".c and run using c compiler is ok. but in c++ it is giving error ..
I think i made mistake when compiling is there any tag to be included like "-lpthread" for c++
Can someone pls send a valid code...?
Actually this is my code
int cooperbussman :: startlistenthread()
{
if(pthread_create(&m_thread,0,&packetreadertask,0)<0)
{
cout<<"Unable to create the thread Startlistenthread\n";
return -1;
}
return 1;
and the error i am getting is
cooperbussman.cpp: In member function âint cooperbussman::startlistenthread()â: cooperbussman.cpp:76: error: invalid conversion from âvoid* (*)()â to âvoid* (*)(void*)â cooperbussman.cpp:76: error: initializing argument 3 of âint pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)â