title: undefined reference to `pthread_create' -pthread not working
body: <p>I'm creating new threads in a function, and I've included pthread.h. But it's not working, I keep receiving the following error upon compiling:</p>
  
  <blockquote>
    <p>undefined reference to `pthread_create'</p>
  </blockquote>
  
  <p>The flags I'm using to compile are the following:</p>
  
  <blockquote>
    <p>CFLAGS=-std=gnu99 -pthread -g -Wall -Wextra -Werror
    -Wmissing-declarations -Wmissing-prototypes -Werror-implicit-function-declaration -Wreturn-type -Wparentheses -Wunused -Wold-style-definition -Wundef -Wshadow -Wstrict-prototypes -Wswitch-default -Wunreachable-code</p>
  </blockquote>
  
  <p>The compiler is gcc</p>
  
  <p>Makefile: </p>
  
  <pre><code>CC=gcc
  CFLAGS=-std=gnu99 -pthread -g -Wall -Wextra -Werror -Wmissing-declarations -Wmissing-prototypes -Werror-implicit-function-declaration -Wreturn-type -Wparentheses -Wunused -Wold-style-definition -Wundef -Wshadow -Wstrict-prototypes -Wswitch-default -Wunreachable-code
  
  all: finder
  
  finder: stack.o list.o finder.o
      $(CC) -o mfind stack.o list.o mfind.o
  
  stack.o: stack.c stack.h
      $(CC) -c stack.c $(CFLAGS)
  
  list.o: list.c list.h
      $(CC) -c list.c $(CFLAGS)
  
  finder.o: finder.c finder.h
      $(CC) -c finder.c $(CFLAGS)
  
  clean:
      rm -f *.o finder
  </code></pre>