简单来说就算gcc4.7.1的API是 Win32 thread API.
转自stackoverflow
MinGW (which is included in TDM-GCC) comes with one of two APIs for threads: either winpthreads (based on the POSIX threads API, pthreads) or the Win32 thread API. If you have a version with the Win32 thread API, std::thread is disabled. TDM-GCC 4.7.1 uses the Win32 thread API, while TDM-GCC 4.8.1 and later come with winpthreads. That's why the compiler succeeded in one case but not the other.
This leads to 2 possible solutions for the 'thread' is not a member of 'std'
problem:
- Install a version of TDM-GCC that uses winpthreads (either standalone or with Code::Blocks). This means 4.8.1 or later.
- Use the MinGW installer, which lets you choose which thread API to install. It also lets you choose what version of MinGW (which nowadays corresponds to the version of GCC included) to install, so you can even choose an older version such as 4.7.3, which is more stable than 4.8.1.