C++编译错误,std 中的互斥锁不会在 MinGW (GCC 6.3.0) 中命名类型
C++ compile error, mutex in std does not name a type in MinGW (GCC 6.3.0)
我正在尝试在Windows 10 64位上使用MinGW(G ++ 6.3.0(编译Mongo C++11驱动程序。来自 GCC 6 发行说明;
默认模式已更改为 -std=gnu++14。
我的理解是默认情况下也支持 C++11。那么为什么我会收到这些关于互斥锁和线程的错误消息?
from F:/Projects/Mongo/attempt_4_mingw64/mongo-cxx-driver-r3.1.1/src/mongocxx/exception/private/mongoc_error.hh:19,
from F:ProjectsMongoattempt_4_mingw64mongo-cxx-driver-r3.1.1srcmongocxxbulk_write.cpp:20:
F:/Projects/Mongo/attempt_4_mingw64/mongo-cxx-driver-r3.1.1/src/mongocxx/test_util/mock.hh:183:10: error: 'mutex' in namespace 'std' does not name a type
std::mutex _active_instances_lock;
^~~~~
F:/Projects/Mongo/attempt_4_mingw64/mongo-cxx-driver-r3.1.1/src/mongocxx/test_util/mock.hh:184:24: error: 'thread' is not a member of 'std'
std::unordered_map<std::thread::id, instance*> _active_instances;
^~~
F:/Projects/Mongo/attempt_4_mingw64/mongo-cxx-driver-r3.1.1/src/mongocxx/test_util/mock.hh:184:24: error: 'thread' is not a member of 'std'
F:/Projects/Mongo/attempt_4_mingw64/mongo-cxx-driver-r3.1.1/src/mongocxx/test_util/mock.hh:184:50: error: wrong number of template arguments (1, should be at least 2)
std::unordered_map<std::thread::id, instance*> _active_instances;
^
mongocxx目前只支持Windows上的MSVC,因此使用MinGW构建可能无法实现。话虽如此,如果你还没有,我建议在你的CMAKE_CXX_FLAGS中传递-std=c++11
,看看这是否有效。
相关文章:
- 为什么与常规GCC不同,即使有"学究性错误",MinGW-GCC也能容忍丢失的返回类型
- 使用 MINGW gcc 编译时,不会为 std::string 调用重载的新运算符
- Mingw-W64 GCC 无法识别来自 DXGiformat.h 的DXGI_FORMAT
- G++无法编译Win7,64位(MinGW.org GCC-6.3.0-1)
- MinGW GCC通配符编译所有文件(Windows)
- C++编译错误,std 中的互斥锁不会在 MinGW (GCC 6.3.0) 中命名类型
- C++ MinGW GCC CodeBlocks静态链接
- 我的代码在使用GCC-MinGW时不再编译
- 在 mingw 的 gcc-5.3 下具有混合位域和枚举递减的结构的意外大小
- 什么是GCC和MingW,它们与C 有何关系
- 使用GCC/Mingw创建代理DLL
- InterlockedOr8 on gcc MinGW
- GCC (MingW-w64) 找不到基构造函数 (!?)
- GCC/MINGW中'startup files'来源
- GCC(MinGW)链接器在尝试使用GetProcessImageFileName时失败
- rand_r不在作用域中,gcc-mingw在windows上的cygwin下
- 当文件有换行符时,ifstream::tellg在MSVC2012和gcc(mingw)上有所不同
- C++ GCC/MinGW 路径:ssp、ext、tr1;并行,扩展,位,实验
- 如何获取由 GCC-MINGW 编译的进程的最大内存使用量
- 用于检查编译器是gcc/mingw还是VC++cl的标志