使用unordered_map编译报#error This file requires compiler and library support
来源:互联网 发布:羽毛球鹰眼算法 编辑:程序博客网 时间:2024/06/05 03:18
最近常用到unordered_map,但是我发现这个库在vc6中不能用,无赖只好换成vs2012,测试可以用。然而,我在linux下用g++编译时,出现了以下错误:
In file included from /usr/include/c++/4.8/unordered_map:35:0,
from cul.cc:3:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
cul.cc: In member function ‘int Solution::lengthOfLongestSubstring(std::string)’:
cul.cc:15:4: error: ‘unordered_map’ was not declared in this scope
unordered_map<char,int> hash;
....
后面的信息可以看出,是说unordered_map没有定义,我在网上查找了下发现g++4.4之后都支持,我用的是4.8,应该可以正常使用的。最后看到这句:This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.发现时需要编译时加上-std=c++11这个参数,才可以使用,如下:
g++ -std=c++11 -g -o cu cul.cc
发现编译OK!!
- 使用unordered_map编译报#error This file requires compiler and library support......
- 使用unordered_map编译报#error This file requires compiler and library support
- 编译报#error This file requires compiler and library support......
- error: #error This file requires compiler and library support for the ISO C++ 2011 standard.
- #error This file requires compiler and library support for the ISO C++ 2011错误解决办法
- error This file requires compiler and library support for the ISO C++ 2011 standard.
- #error This file requires compiler and library support for the ISO C++ 2011错误解决办法
- error This file requires compiler and library support for the ISO C++ 2011 standard
- #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. Th
- C++中使用array报错 requires compiler and library surpport for the ISO c++ 2011 standard
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x
- 我的收藏
- eclipse -解决Unhandled event loop exception GC overhead limit exceeded
- N种内核注入DLL的思路及实现
- Android系统原理与源码分析(1):利用Java反射技术阻止通过按钮关闭对话框
- mysql更改某个字段的默认值
- 使用unordered_map编译报#error This file requires compiler and library support
- 解包官方UPDATA.APP文件神器工具bootimg.exe工具及详细教程
- 安全漏洞的分类、描述与解决方案
- [水题] HDU 1049 Climbing Worm
- spring jpa 行级锁的实现
- GRE写作必备句型
- tabView的手势冲突问题解决方法
- POJ 3414:Pots
- Snail—OC学习之可变字典NSMutableDictionary