hash_map error

Hello,

Im trying to compiling my code but I have an error and I don't know why.

1
2
3
4
5
#include <hash_map>
<...>
  hash_map<const char*, class c_simbolo *, hash<const char*>, eqstr> tabla; 
<...> 
 


Then the compiler shows this message: error: ‘hash_map’ no nombra a un tipo (something like hash_map does not name any type)

The compiler is g++ 4:4.7.2-1ubuntu2. (I also tried in windows with codeblock)

I have included using namespace std but the problem still exist.

It doesn't matter the hash_map sentence, in all of them I have the same problem.

Thank you for your help.
Last edited on
There is no std::hash_map. There is std::unordered_map.

1
2
3
4
5
#include <unordered_map>

// ...

std::unordered_map<const char *, class c_simbolo *, hash<const char *>, eqstr> tabla;


http://cplusplus.com/reference/unordered_map/unordered_map/

Be advised, this is a C++11 (C++0x old name) feature and may not be available in your C++ compiler's library.

Edit: be sure to compile with:
g++ -std=c++0x file.cpp -o file.exe


or

g++ -std=c++11 file.cpp -o file.exe
Last edited on
Thank you very much for your help.

That solved my problem.
Topic archived. No new replies allowed.