to run code with threads on Linux use this command: g++ main.cpp -std=c++0x -lpthread -o demo then run: ./demo