小编lui*_*uis的帖子

std :: thread错误(线程不是std的成员)

我使用macports编译并安装了gcc4.4.

当我尝试使用 - > g ++ -g -Wall -ansi -pthread -std = c ++ 0x main.cpp ...进行编译时:

 #include <thread>
 ...
  std::thread t(handle);
  t.join();
 ....
Run Code Online (Sandbox Code Playgroud)

编译器返回:

 cserver.cpp: In member function 'int CServer::run()':
 cserver.cpp:48: error: 'thread' is not a member of 'std'
 cserver.cpp:48: error: expected ';' before 't'
 cserver.cpp:49: error: 't' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

std::cout <<...编译好..

谁能帮我?

c++ multithreading gcc std c++11

23
推荐指数
3
解决办法
4万
查看次数

标签 统计

c++ ×1

c++11 ×1

gcc ×1

multithreading ×1

std ×1