使用mingw和g ++ 4.7.2让std :: thread / mutex在Win7下工作 [英] Getting std::thread/mutex to work under Win7 with mingw and g++ 4.7.2

查看:711
本文介绍了使用mingw和g ++ 4.7.2让std :: thread / mutex在Win7下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


恭喜,


我最近搬出了我的unix避难所来测试一个所谓的跨平台网络库,以便发现那个mingw不喜欢被喂食c ++ 11的东西。



我猜想我错过了所需的头文件,因为Win7没有与c + +11支持。

VS2012
编译得很好,但g ++拒绝。


 错误:命名空间'std'中的'thread'没有命名类型
错误:命名空间'std'中的'mutex'不名称类型


问题是:
p>

如何获得c ++ 11头文件/ libs的副本,即<线程,而不使用VS2012安装提供的。



#1我尝试了mingw-get update,但它仍然不会找到<线程>

P.S. #2我也使用-std = c ++ 11


谨此
Chris。


<这些MinGW-w64构建支持C ++ 11线程,原子操作等。




  1. MinGW-builds现已集成进入MinGW-w64项目

  2. MinGW-builds(项目是旧的,不会更新,请参阅上面的要点)

  3. MinGW-w64 rubenvb 64-bit 32位构建


  4. 请注意,MinGW -w64不仅仅是64位,但支持它,不像旧的MinGW(.org)这是缺少了很多新的Vista + API,当然还有64位支持。



    Greetings,

    I've recently moved out of my unix shelter to test a supposedly cross-platform networking library only to discover that mingw doesn't like to be fed c++11 stuff.

    I presume that I'm missing the required headers since Win7 doesn't come packed with c++11 support.

    It compiles just fine with VS2012
    but g++ refuses to.

    error: 'thread' in namespace 'std' does not name a type
    error: 'mutex' in namespace 'std' does not name a type
    

    The question is:

    How do I get a copy of c++11 headers/libs i.e. < thread > without using the ones provided by VS2012 installation.

    P.S. #1 I tried mingw-get update but it still wont find < thread >
    P.S. #2 I am also using -std=c++11


    Sincerely,
    Chris.

    解决方案

    These MinGW-w64 builds support C++11 threads,atomic operations etc.

    1. MinGW-builds are now integrated into the MinGW-w64 project
    2. MinGW-builds (project is old and will not be updated, see point above)
    3. MinGW-w64 rubenvb 64-bit and 32-bit builds

    Note that MinGW-w64 is not 64-bit only, but does support it, unlike the old MinGW(.org) which is missing quite a lot of the new Vista+ APIs, and of course 64-bit support.

    这篇关于使用mingw和g ++ 4.7.2让std :: thread / mutex在Win7下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆