title: Issue compiling program utilizing pthread.h
body: <p>I am trying to compile the following program on a Linux (Ubuntu) machine:</p>
  
  <pre><code>#include &lt;pthread.h&gt;
  #include &lt;stdio.h&gt;
  int sum; /* this data is shared by the thread(s) */
  void *runner(void *param); /* threads call this function */
  int main(int argc, char *argv[])
  {
  pthread t tid; /* the thread identifier */
  pthread attr t attr; /* set of thread attributes */
  if (argc != 2) {
  fprintf(stderr,"usage: a.out &lt;integer value&gt;\n");
  return -1;
  }
  if (atoi(argv[1]) &lt; 0) {
  fprintf(stderr,"%d must be &gt;= 0\n",atoi(argv[1]));
  return -1;
  }
  /* get the default attributes */
  pthread attr init(&amp;attr);
  /* create the thread */
  pthread create(&amp;tid,&amp;attr,runner,argv[1]);
  /* wait for the thread to exit */
  pthread join(tid,NULL);
  printf("sum = %d\n",sum);
  }
  /* The thread will begin control in this function */
  void *runner(void *param)
  {
  int i, upper = atoi(param);
  sum = 0;
  for (i = 1; i &lt;= upper; i++)
  sum += i;
  pthread exit(0);
  }
  </code></pre>
  
  <p>However whenever I try to do so:
  <em>gcc -o runner runner.c</em> 
  I get an error "Unknown type name 'pthread'.
  Now I've been looking around and see I have to include -lpthread:
  <em>gcc -o runner runner.c -lpthread</em> 
  However it produces the very same error.</p>
  
  <p>I've run the following command: <em>whereis pthread</em> and it returns the file location so I know i have the file.</p>