When I tried to compile this program, it failed:
#include
#include
#include
#include
voi
Others have mentioned that you haven't linked with the pthread library using the -lpthread
flag. Modern GCC (not sure how modern, mine is 4.3.3) allows you to use just -pthread
. From the man page:
-pthread
Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker.