How to include hash_map in C++ 4.4.6?

883 Views Asked by At

I am using hash_map in my C++ application. When I build the application with version 4.1.2 build succeeded. When I try to build the application with version 4.4.6 it is throwing error as

/include/c++/4.4.6/backward/backward_warning.h:28:2: error: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.

Based on the suggestion I looked at /usr/include/c++/4.4.6/backward/backward_warning.h and changed the hash_map to unordered_map.

Now I am getting the following error,

/include/c++/4.4.6/c++0x_warning.h:31:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

I can see only the error message in /usr/include/c++/4.4.6/c++0x_warning.h.

I am fairly new to C++. Could someone help me with this?

1

There are 1 best solutions below

2
On

Assuming you are using GCC (g++), try adding -std=c++0x to your command line as the message says to have the compiler use C++11.