问题描述
您好,
我最近搬出我的 unix 避难所来测试一个所谓的跨平台网络库,结果发现 mingw 不喜欢吃 c++11 的东西.
我认为我缺少所需的标头,因为 Win7 不包含 c++11 支持.
用VS2012编译就好了
但 g++ 拒绝.
错误:命名空间std"中的线程"没有命名类型错误:命名空间std"中的mutex"未命名类型
问题是:
如何获得 c++11 头文件/库的副本,即 <thread > 不使用 VS2012 安装提供的那些.
附:#1 我尝试了 mingw-get update 但它仍然找不到 <线程 >
附言#2 我也在使用 -std=c++11
真诚的,
克里斯.
这些 MinGW-w64 构建支持 C++11 线程、原子操作等.
- MinGW-builds 现已集成到 MinGW-w64 项目中
- MinGW-builds(项目旧,不会更新,见上)
- MinGW-w64 rubenvb 64位和32位构建
请注意,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.
- MinGW-builds are now integrated into the MinGW-w64 project
- MinGW-builds (project is old and will not be updated, see point above)
- 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 下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!