title: pthread library not found when building executable?
body: <p>I'm trying to build a simple test program for a ThreadManager class I created. As you can see in the output below, my ThreadManager and main code seems to compile into object files just fine, but then when creating the executable, it can't seem to find proper references to any of the functions from the pthread class. What am I missing?</p>
  
  <pre><code>g++    -c -o ThreadManager.o ThreadManager.cpp  
  g++    -c -o main.o main.cpp  
  g++ -o tm_test ThreadManager.o main.o -g    -lm  
  
  ThreadManager.o: In function `ThreadManager::Create(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, void* (*)(void*))':  
  ThreadManager.cpp:(.text+0x276): undefined reference to `pthread_create'  
  ThreadManager.o: In function `ThreadManager::Create(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, void* (*)(void*), void*)':  
  ThreadManager.cpp:(.text+0x4a3): undefined reference to `pthread_create'  
  ThreadManager.o: In function `ThreadManager::Create(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, void* (*)(void*), void*, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;)':  
  ThreadManager.cpp:(.text+0x70b): undefined reference to `pthread_create'  
  ThreadManager.o: In function `ThreadManager::Cleanup(int)':  
  ThreadManager.cpp:(.text+0x8d4): undefined reference to `pthread_join'  
  ThreadManager.cpp:(.text+0xa5f): undefined reference to `pthread_join'  
  ThreadManager.cpp:(.text+0xbe1): undefined reference to `pthread_kill'  
  ThreadManager.o: In function `ThreadManager::Resurrect()':  
  ThreadManager.cpp:(.text+0xe8c): undefined reference to `pthread_create'  
  ThreadManager.o: In function `ThreadManager::Kill(int)':  
  ThreadManager.cpp:(.text+0x125f): undefined reference to `pthread_cancel'  
  ThreadManager.cpp:(.text+0x1285): undefined reference to `pthread_join'  
  ThreadManager.o:(.rodata+0x1a0): undefined reference to `pthread_cancel'  
  main.o:(.rodata+0x5c): undefined reference to `pthread_cancel'  
  collect2: ld returned 1 exit status  
  make: *** [tm_test] Error 1
  </code></pre>
  
  <p>Thanks,</p>