std::thread を使用したソースを -pthread オプションを付けずにビルドすると、ビルドエラーにならずに実行時エラーになる仕組みが気になったので調べてみました。 パスやら何やらは x86-64 版の Gentoo Linux のものです。他ディストリビューションでは微妙に異なるかもしれません。 -pthread オプション g++ や clang++ で C++11 以降に実装された std::thread を使おうとすると、オプション -pthread が必要です。これを忘れると、スレッドを実行しようとした時点で例外が発生してしまいます。 #include <iostream> #include <thread> void func() { std::cout << "Hello!" << std::endl; } int main() { std::thread(func