std::thread is not a member of namespace std using Eclipse Kepler MinGW

前端 未结 3 638
闹比i
闹比i 2020-11-29 11:51

I\'m trying to compile a simple c++ program that uses std::thread on eclipse kepler / mingw 4.8.1 and win32. I hope to move development to linux at some point after many ye

3条回答
  •  北海茫月
    2020-11-29 12:41

    Plain MinGW cannot support std::thread. You will need to use a MinGW-w64 toolchain (such as those shipped with Qt 5) that has "posix" threading enabled, so that libstdc++ exposes the , and functionality.

    You can find an installer here, but you can also try just replacing the whole mingw toolchain root folder with one of these packages. You can choose 32- or 64-bit, remember to select threads-posix if you want to play with std::thread and friends. No special compiler options other than the ones you already have are needed. I do suggest using -std=c++11 if you don't need GCC 4.6 compatibility.

提交回复
热议问题