Using pthread in c++

You might try using the -pthread option to g++.

   -pthread
       Adds support for multithreading with the pthreads library.  This
       option sets flags for both the preprocessor and linker.

Leave a Comment