title: Undefined reference to pthread_create pthread_join' in Linux
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;pthread.h&gt;
  volatile int Licznik;
  
  void * thread1 (void * v1){
      while(1) Licznik++;
  }
  
  void * thread2 (void * v1){
      while(1) printf("%d ", Licznik);
  }
  
  int main(){
      pthread_t w1, w2;
      pthread_create(&amp;w1, NULL, thread1, NULL);
      pthread_create(&amp;w2, NULL, thread2, NULL);
      sleep(5);
      pthread_join(w1, NULL);
      return 0;
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>/tmp/ccfGEzAp.o: In function `main':
  main1.c:(.text+0x6c): undefined reference to `pthread_create'
  main1.c:(.text+0x87): undefined reference to `pthread_create'
  main1.c:(.text+0xa7): undefined reference to `pthread_jo
  </code></pre>