好的,我在CodeBlocks IDE 12.11上用MinGW编译以下简单的代码块(在cplusplus.com上找到)(单独下载,截至今天也是最新版本)。 的事情是,它显示了在编译以下错误:奇怪的线程问题
12: error: 'thread' was not declared in this scope
12: error: expected ';' before 't1'
13: error: 't1' was not declared in this scope
#include <iostream>
#include <thread>
using namespace std;
void hello(void){
cout << "hey there!" << endl;
}
int main()
{
thread t1(hello);
t1.join();
return 0;
}
在线程不GCC支持完全我是否需要标志添加到我的编译器,以及如何做到这一点的一个代码块项目?在此先感谢
检查g ++版本。在'线索'头文件中查看它是否定义了线程类。 – vrdhn
您是否注意到页面顶部的黄色惊叹号表示它是C++ 11功能并且可能不被所有编译器支持? –
@Vardhan g ++版本4.8.1。此外线程头文件包括类线程 – TheDillo