I picked up the following demo off the web from https://computing.llnl.gov/tutorials/pthreads/
#include
#include
#define NU
Both answers to this question so far are incorrect.
For Linux the correct command is:
gcc -pthread -o term term.c
In general, libraries should follow sources and objects on command line, and -lpthread
is not an "option", it's a library specification. On a system with only libpthread.a
installed,
gcc -lpthread ...
will fail to link.