If you use C++ threads with the GCC compiler (or perhaps more accurately, with the libstdc++ C++ standard library which ships with GCC) on Linux, you may need to include the -pthread option in your build process to get things to compile and link properly.
What I'm curious about is which library headers invoke that requirement? #include <thread> is an obvious one, but are there other standard library headers which implicitly have a pthread dependency for libstdc++?
<iostream>could have<thread>included. - NathanOliverpthreador not for threading is an implementation detail. If you get a linker error add the library. When I include standard threading headers<thread>I don't need to specifically link against-lpthread. I assume that my implementation of the standard is doing the appropriate linking for me (or dynamically loading the appropriate libraries at runtime, I don't know nor should I care (in most cases)). - Martin York