title: pthread_create error:
body: <p>i have written this piece of code for my own purpose.it will create a thread which runs a routine named event_handler().the routine event_handler will take an instance of the class object QApplication as an argument and invoke its exec() method.</p>
  
  <pre><code>#include &lt;pthread.h&gt;
  
  
  void event_handler(void * &amp;obj)
  {
      QApplication* app = reinterpret_cast&lt;QApplication*&gt;(&amp;obj);
      app.exec();
  }
  
  int main(int argc, char **argv)
  {
      pthread_t p1;
  
      QApplication a(argc, argv);
  
      pthread_create(&amp;p1, NULL, &amp;event_handler,(void *) &amp;a);
  
      //do some computation which will be performed by main thread
  
      pthread_join(*p1,NULL);
  
  
  }
  </code></pre>
  
  <p>But whenever i am trying to build this piece of code, i am getting this error</p>
  
  <pre><code>main.cpp:10: error: request for member ‘exec’ in ‘app’, which is of non-class type ‘QApplication*’
  main.cpp:34: error: invalid conversion from ‘void (*)(void*&amp;)’ to ‘void* (*)(void*)’
  main.cpp:34: error: initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)’
  </code></pre>
  
  <p>what is the problem in my code.(keeping in mind that i am a newbie in this area it may be a very silly mistake :-) )</p>