1.thread is not a member of std, or you maybe forget '#include <thread>'
出现上面的错误提示,是你的mingw版本不对,选择支持poxis规范的版本,如下:
x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0.7z(可百度,或google)
下载后,解压;假设你解压的路径是 D:\mingw64
2.配置codeblock的编译器,settings->compiler->global compiler settings->toolchain executables;
3.配置codeblock的编译器,settings->compiler->global compiler settings->compiler flags,选择c++11 iso;
3.编译下面代码就不会出现错误了。
#include <iostream>
#include <thread>
#include <future>
using namespace std;
void helloworld()
{
cout<<"hello world \n";
}
int main()
{
std::thread t(helloworld);
t.join();
std::cout<<"nihao"<<endl;
return 0;
}