在 C++ 中,我试图声明 unordered_set
就像这样:
std::unordered_set<int> k;
但它显示此错误:
error: 'unordered_set' is not a member of 'std'
我在 Windows 上使用 MinGW 使用 g++ (GCC) 5.3.0。以下是我已经考虑过的事情:
- 通过
#include <unordered_set>
添加头文件 - 升级 MinGW
- 使用标志
-std=gnu++11
。 (这不会生成任何可执行文件或错误,不确定它是否执行任何操作)
如何修复它并成功编译我的代码?
最佳答案
使用-std=c++11
开关并指定输出文件。
g++ -std=c++11 your_file.cpp -o your_program
关于c++ - 错误: 'unordered_set' is not a member of 'std' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41697173/