On Linux (kernel 2.6.5) our build system calls gcc with -D_REENTRANT.
Is this still required when using pthreads?
For me the best answer was the comment from pts if only he bothered to submit it as answer:
You investigated properly and answered your own question. Use
g++ -pthread, it is equivalent tog++ -lpthread -D_REENTRANT. Usingg++ -D_REENTRANTwould be different, it may not set all the linker flags. – pts May 18 at 0:30