Compile: #include <pthread.h> // #include <iostream> int main() { pthread_mutexattr_t *attr; pthread_mutexattr_init(attr); return 0; } You get a link error. Compile: #include <pthread.h> #include <iostream> int main() { pthread_mutexattr_t *attr; pthread_mutexattr_init(attr); return 0; } It compiles with no warnings (g++ -Wall testcase.cpp), but when executed, segfaults. Compiling with -lpthread fixes it, of course, but should this be a link-time error rather than a runtime error? This bug was originally reported in Ubuntu's Malone bugtracker: https://launchpad.net/distros/ubuntu/+source/gcc-4.0/+bug/26663
*** This bug has been marked as a duplicate of 4372 ***