【发布时间】:2017-11-17 23:08:26
【问题描述】:
我正在尝试在 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:\Projects\Mongo\attempt_4_mingw64\mongo-cxx-driver-r3.1.1\src\mongocxx\bulk_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;
^
【问题讨论】:
-
您是否正在运行一个构建系统,可以让您查看执行的命令?哪些标志被传递给编译器?你也能证明这一点吗?使用的编译器真的是你所期望的吗?
-
@Someprogrammerdude,我使用的是 CMake 3.8,它提供了这种输出
-- Check for working CXX compiler: C:/MinGW64/bin/g++.exe -- works。所以肯定它使用 G++,我唯一的版本是 6.3.0。 -
如果您运行
make VERBOSE=1,您将看到传递给编译器的标志。类似-std=c++03(或类似)的东西是否传递给编译器?
标签: c++ mongodb c++11 gcc mingw