Avi*_*etz 4 c++ hashmap visual-studio-2008
我正在使用Visual Studio 2008.这是我的代码:
#include "stdafx.h"
#include <conio.h>
#include <hash_map>
#include <iostream>
using namespace std;
hash_map <int, int> hm;
int main()
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是我的错误:
error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Run Code Online (Sandbox Code Playgroud)
在MSVC编译器中,标准库的扩展名放在stdext命名空间中:
#include <hash_map>
stdext::hash_map<int, int> hm;
int main()
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
免责声明:我不拥有VS2008,但这应该有效.:)
但请注意,如果可能,您应该更新到最新的编译器,并使用新的标准无序容器:std::unordered_map和std::unordered_set.
| 归档时间: |
|
| 查看次数: |
328 次 |
| 最近记录: |