Anil
Anil

Reputation: 318

Error while including header file unordered_map

When I include the unordered_map header file in my code it gives me following error

"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/include/c++/bits/hashtable.h:
In constructor 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(_InputIterator, 
_InputIterator, std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, 
_H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1&, const _H2&,
const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&)':

 error: expected unqualified-id before '(' token
 [   29s]  #define max(a, b)    (((a) > (b)) ? (a) : (b))"

and I'sure there is no syntax error. I think there a conflict between macro and std::unordered_map but I don't know how to resolve this. Here I'm including the unordered_map in a file which is included by another file similarly the header file where macro max is defined is also included in the same file.

Upvotes: 2

Views: 337

Answers (2)

SoronelHaetir
SoronelHaetir

Reputation: 15182

Figure out where the max() define is coming from, if it's in your own code you should probably remove it, if it's in a system header try moving that include until after

Upvotes: 0

Rene
Rene

Reputation: 2466

Yes, there is a conflict between your macro max() and the std::max() function.
The solution should be simple: Delete your max() macro and use std::max() instead.

Upvotes: 2

Related Questions