Note that there are some explanatory texts on larger screens.

plurals
  1. POmap in c++ causes error
    primarykey
    data
    text
    <p>I have header file. I want a map object added to one of the structures. So I included </p> <pre><code>#include&lt;map&gt; </code></pre> <p>and compiled the program (note I did not use map object I just included it) and I got the following error</p> <pre><code>/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&lt;_Key, _Tp, _Compare, _Alloc&gt;::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&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_compare std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::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&lt;_Key, _Tp, _Compare, _Alloc&gt;::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&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_compare std::multimap&lt;_Key, _Tp, _Compare, _Alloc&gt;::value_comp() const': /usr/include/c++/4.7/bits/stl_multimap.h:656:46: error: expected primary-expression before ';' token </code></pre> <p>As an experiment I moved the include to a cpp file and it was compiling properly.</p> <p>What could be the reason</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload