Add lpthread in makefile

view story

http://ubuntuforums.org – Hi, How to add lpthread option to my makefile? My make command output is as bellow: Code: huangyingw@laptop:/media/volgrp/myproject/git/cplusplus/linux/fundamental/semaphore$ make g++ -ansi -W -Wall -lstdc++ -I../test -lpthread test.o -o test.exe test.o: In function `main': test.cc:(.text+0xbc): undefined reference to `pthread_create' test.cc:(.text+0xd7): undefined reference to `pthread_create' test.cc:(.text+0xe8): undefined reference to `pthread_join' test.cc:(.text+0xf9): undefined reference to `pthread_join' collect2: error: ld returned 1 exit status make: *** [test. (Hardware)