在代码块中编译线程程序时出错
Error compiling thread program in codeblocks
我的线程程序是:
#include<iostream>
#include<thread>
using namespace std;
void t()
{
cout<<"from threadn";
}
int main()
{
thread i(&t);
cout <<"from mainn";
i.join();
}
但是在代码块中显示以下错误:
1)'thread ' was not declared in this scope
2)expected ';' before 'i'
3)'i' was not declared in this scope
我怎么解决它?我正在使用windows和代码块12.11
首先,您使用的是windows还是linux?
如果你在linux上,你必须编译c++ 11支持。只需将-std=c++11传递给c++。我帮不了你的忙。
您的IDE可能还不支持c++ 11。因为thread
从c++ 11开始就包含在标准中了。看到这个线程的代码块?http://forums.codeblocks.org/index.php?topic=15536.0
相关文章:
- 重载操作程序时出错>>用于类中的字符串 memebr
- 分段错误当我试图运行程序时出错
- 使用 Visual Studio 2019 构建 Hello World wxwidgets 应用程序时出错
- 在另一台 PC 上执行程序时加载 SDL2 共享库时出错
- 修改气泡排序的程序出错
- 包含多维数组的程序出错
- 程序出错C++
- 检查完美的程序出错了
- 带有私有构造函数的程序出错
- LunarLander程序出错:符号未解析
- C++程序出错
- 结构:初始化程序出错
- 编译简单的应用程序出错
- 在树莓派上编译c++ opencv应用程序出错
- 链接基于Qt的应用程序出错
- 简单数学程序出错
- 具有未定义行为但从未实际执行的表达式是否会使程序出错
- 目录列表程序出错,c++
- Qt LNK2019 基本 Qt5 应用程序出错
- 我的简单阶乘计算器c++程序出错了吗?