yokeyoke 2016-10-09 10:27 采纳率: 100%
浏览 7544
已结题

C++ 多线程不能通过编译问题('thread' is not a member of 'std')

 #include <iostream>
#include <thread>
using namespace std;

void thread_task()
{
    std::cout << "hello thread" << std::endl;
}

int main(int argc, const char *argv[])
{
    std::thread t(thread_task);
    t.join();
    return EXIT_SUCCESS;
}

错误信息:
'thread' is not a member of 'std'|

环境如下:
windows 7 64 bit;

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-pc-mingw32/6.1.0/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../configure --prefix=/mingw/opt/gcc --with-local-prefix=/mingw/opt/gcc --with-native-system-header-dir=/mingw/opt/gcc/i686-pc-mingw32/include --with-gxx-include-dir=/mingw/opt/gcc/i686-pc-mingw32/include/c++/6.1.0 --target=i686-pc-mingw32 --enable-languages=c,c++,fortran,java,objc,obj-c++ --enable-static --enable-shared --enable-libgomp --enable-lto --enable-threads=posix --enable-libstdcxx --enable-libstdcxx-debug --enable-graphite --enable-tls --enable-nls --disable-bootstrap --disable-stage1-checking --disable-multilib --disable-libvtv --disable-sjlj-exceptions --disable-libstdcxx-pch --disable-win32-registry --with-dwarf2 --with-gmp=/mingw/opt/gcc --with-mpfr=/mingw/opt/gcc --with-mpc=/mingw/opt/gcc --with-isl=/mingw/opt/gcc
Thread model: posix
gcc version 6.1.0 (GCC)

IDE:codeBlocks 16.10

图片说明

  • 写回答

6条回答 默认 最新

  • robin8624 2016-10-10 08:40
    关注

    C++11才支持的,大多数C++编译器都不支持。。
    这么新的东东其实没什么实用价值

    评论

报告相同问题?

悬赏问题

  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导