title: Undefined reference to pthread_create
body: <p>I have this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;pthread.h&gt;
  
  void* cuoco(void* arg)
  {
      fprintf(stderr,"Inizio codice cuoco\n");
      fprintf(stderr,"Fine codice cuoco\n");
      return NULL;
  }
  
  void* cameriere(void* arg)
  {
      fprintf(stderr,"Inizio codice cameriere\n");
      fprintf(stderr,"Fine codice cameriere\n");
      return NULL;
  }
  
  void* cliente(void* arg)
  {
      fprintf(stderr,"Inizio codice cliente\n");
      fprintf(stderr,"Fine codice cliente\n");
      return NULL;
  }
  
  int main(int argc, char* argv[])
  {
      void* (*routine)(void*);
      routine=cuoco;
      pthread_t thread_cuoco,thread_cameriere,thread_cliente;
      pthread_create(&amp;thread_cuoco,NULL,routine,NULL);
      return 0;
  }
  </code></pre>
  
  <p>And in the compiler options I insert <em>-lpthread</em><br>
  But it says:<br>
  "Undefined reference to pthread_create"<br>
  I use ubuntu 10.10, so I already have pthread library installed, I can't figure the reason of this error.</p>