This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: type mismatch when compile 1999 code
On 23 June 2011 09:20, eric wrote:
> eric@eric-laptop:~/CppPrimer3/download/chap17$ g++ Query.C UserQuery.C
> TextQuery.C text_query.C
> In file included from UserQuery.C:1:0:
> UserQuery.h:46:68: error: wrong number of template arguments (3, should
> be 2)
> /usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c
> ++/4.5.2/bits/stl_stack.h:92:11: error: provided for ‘template<class
> _Tp, class _Sequence> class std::stack’
> UserQuery.h:47:68: error: wrong number of template arguments (3, should
> be 2)
> /usr/local/lib/gcc/i686-pc-linux-gnu/4.5.2/../../../../include/c
> ++/4.5.2/bits/stl_stack.h:92:11: error: provided for ‘template<class
> _Tp, class _Sequence> class std::stack’
> UserQuery.h: In member function ‘void UserQuery::evalAnd()’:
> UserQuery.h:73:28: error: request for member ‘top’ in
> ‘((UserQuery*)this)->UserQuery::_query_stack’, which is of non-class
> type ‘int’
> UserQuery.h:73:48: error: request for member ‘pop’ in
> ‘((UserQuery*)this)->UserQuery::_query_stack’, which is of non-class
> type ‘int’
> UserQuery.h:79:14: error: request for member ‘push’ in
> ‘((UserQuery*)this)->UserQuery::_current_op’, which is of non-class type
> ‘int’
> UserQuery.h: In member function ‘void UserQuery::evalOr()’:
> UserQuery.h:88:28: error: request for member ‘top’ in
> ‘((UserQuery*)this)->UserQuery::_query_stack’, which is of non-class
> type ‘int’
> UserQuery.h:88:48: error: request for member ‘pop’ in
> ‘((UserQuery*)this)->UserQuery::_query_stack’, which is of non-class
> type ‘int’
> UserQuery.h:94:14: error: request for member ‘push’ in
> ‘((UserQuery*)this)->UserQuery::_current_op’, which is of non-class type
> ‘int’
> UserQuery.h: In member function ‘void UserQuery::evalNot()’:
> -------------------------------------------------
> this is only first couple lines of errors, it still have a lot
> is stack(template) is we defined or system(compiler) defined? why it
> must need 2 in stead of 3? ?so should I eliminate last parameter?
Yes, std::stack only has two parameters
> and
> how about other error?
The other errors are caused by the problem with stack, fix that and try again
> need any advancer's help and thanks a lot in advance, Eric
This list is NOT for help learning C++ - your questions are not
related to G++, they are about buggy example code in an old book. You
should look for errata for the book, the code might have been
corrected. You should also try to find somewhere for general C++ help,
instead of asking here when you're not asking questions about G++t