title: Posix Threads in c++
body: <p>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 .. </p>
  
  <p>I think i made mistake when compiling 
  is there any tag  to be included like "-lpthread" for c++</p>
  
  <p>Can someone pls send a valid code...?</p>
  
  <p>Actually this is my code </p>
  
  <pre><code>int cooperbussman :: startlistenthread()
  {
          if(pthread_create(&amp;m_thread,0,&amp;packetreadertask,0)&lt;0)
          {
                  cout&lt;&lt;"Unable to create the thread Startlistenthread\n";
                  return -1;
          }
          return 1;
  </code></pre>
  
  <p>and the error i am getting is </p>
  
  <pre>
  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*)â
  </pre>