Why the following code fails to ld?
Code:#include <pthread.h> void * routine( void * arg){ int x = *(int*)(arg); printf("%d\n",x); } int main(){ pthread_t id; void * thread_result; int status; int arg1 = 1; status = pthread_create(&id, NULL, routine, (void*)(&arg1) ); status = pthread_join(id, &thread_result); return 0; }main.cc:33: undefined reference to `pthread_join'
collect2: ld returned 1 exit status
make: *** [main] Error 1