I have header file. I want a map object added to one of the structures. So I included
#include<map> and compiled the program (note I did not use map object I just included it) and I got the following error
/usr/include/c++/4.7/bits/stl_map.h:115:28: error: macro "value_compare" requires 2 arguments, but only 1 given /usr/include/c++/4.7/bits/stl_map.h:733:45: error: macro "value_compare" requires 2 arguments, but only 1 given In file included from /usr/include/c++/4.7/map:62:0, from ../optimizer_types.h:16, from ../main.cpp:20: /usr/include/c++/4.7/bits/stl_multimap.h:115:28: error: macro "value_compare" requires 2 arguments, but only 1 given /usr/include/c++/4.7/bits/stl_multimap.h:656:45: error: macro "value_compare" requires 2 arguments, but only 1 given In file included from /usr/include/c++/4.7/map:61:0, from ../optimizer_types.h:16, from ../main.cpp:20: /usr/include/c++/4.7/bits/stl_map.h:113:11: error: invalid use of non-static data member 'std::map<_Key, _Tp, _Compare, _Alloc>::value_compare::comp' /usr/include/c++/4.7/bits/stl_map.h:116:4: error: from this location /usr/include/c++/4.7/bits/stl_map.h:116:9: error: '__c' was not declared in this scope /usr/include/c++/4.7/bits/stl_map.h:116:12: error: a function call cannot appear in a constant-expression /usr/include/c++/4.7/bits/stl_map.h:116:12: error: expected ';' at end of member declaration /usr/include/c++/4.7/bits/stl_map.h:116:14: error: expected unqualified-id before '{' token /usr/include/c++/4.7/bits/stl_map.h: In member function 'std::map<_Key, _Tp, _Compare, _Alloc>::value_compare std::map<_Key, _Tp, _Compare, _Alloc>::value_comp() const': /usr/include/c++/4.7/bits/stl_map.h:733:46: error: expected primary-expression before ';' token In file included from /usr/include/c++/4.7/map:62:0, from ../optimizer_types.h:16, from ../main.cpp:20: /usr/include/c++/4.7/bits/stl_multimap.h: At global scope: /usr/include/c++/4.7/bits/stl_multimap.h:113:11: error: invalid use of non-static data member 'std::multimap<_Key, _Tp, _Compare, _Alloc>::value_compare::comp' /usr/include/c++/4.7/bits/stl_multimap.h:116:4: error: from this location /usr/include/c++/4.7/bits/stl_multimap.h:116:9: error: '__c' was not declared in this scope /usr/include/c++/4.7/bits/stl_multimap.h:116:12: error: a function call cannot appear in a constant-expression /usr/include/c++/4.7/bits/stl_multimap.h:116:12: error: expected ';' at end of member declaration /usr/include/c++/4.7/bits/stl_multimap.h:116:14: error: expected unqualified-id before '{' token /usr/include/c++/4.7/bits/stl_multimap.h: In member function 'std::multimap<_Key, _Tp, _Compare, _Alloc>::value_compare std::multimap<_Key, _Tp, _Compare, _Alloc>::value_comp() const': /usr/include/c++/4.7/bits/stl_multimap.h:656:46: error: expected primary-expression before ';' token As an experiment I moved the include to a cpp file and it was compiling properly.
What could be the reason