小编use*_*158的帖子

线程无法处理错误:启用多线程以使用std :: thread:不允许操作

我在我的系统上创建并执行了一个简单的线程.当我执行这个程序时,我有错误消息:启用多线程使用std :: thread:不允许操作

关于我的系统的一些细节:

  • linux ubuntu 13.10
  • g ++ 4.8.1

我编译包括库的源代码 pthread

源代码:

#include <iostream>
#include <thread>


using namespace std;

void func(void) {
  cout << "test thread" << endl;
}


int main() {
  cout << "start" << endl;
  thread t1 (func);

  t1.join();

  cout << "end" << endl;

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ multithreading

31
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×1

multithreading ×1