title: Undefined reference to 'pthread_create' — linker command option order (libraries before/after object files?)
body: <p>When I try to compile that, I receive a particular error. But, it's not possible because I use the right flag. In <code>server.c</code> there is the library <code>pthread.h</code>.
  So, how can I resolve my linking problem?
  I'm using Linux (Ubuntu).   </p>
  
  <pre><code>make
  gcc -c -Wall -Wunused -ansi -pedantic -ggdb  -o Server1.o Server.c
  gcc -c -Wall -Wunused -ansi -pedantic -ggdb  Util.c
  gcc -o Server1.exe -Wall -Wunused -ansi -pedantic -ggdb -lpthread -lm Server1.o Util.o
  Server1.o: In function `main':
  /home/ruggero/ruggero_fine/Server.c:1002: undefined reference to `pthread_create'
  collect2: ld returned 1 exit status
  make: *** [Server1.exe] Errore 1
  </code></pre>