error: expected constructor, destructor, or type conversion before '<' token

Discussion in 'C++' started by amitmool@gmail.com, Oct 28, 2007.

  1. Guest

    hi, i have used the queue library file and try to use the template as

    template <class QueueItem>
    queue <QueueItem>::~queue() // line 25
    {

    }

    template <class QueueItem>
    void queue<QueueItem>::push(const QueueItem& entry) // line 42
    {

    }



    error: expected constructor, destructor, or type conversion before '<'
    token
    queue.template:25: error: expected `;' before '<' token

    queue.template:42: error: expected init-declarator before '<' token
    queue.template:42: error: expected `;' before '<' token


    can u help out to slove this problem
    , Oct 28, 2007
    #1
    1. Advertising

  2. Ian Collins Guest

    Re: error: expected constructor, destructor, or type conversion before'<' token

    wrote:
    > hi, i have used the queue library file and try to use the template as
    >

    Which queue library? Looks like you are missing the declaration of the
    template queue.

    --
    Ian Collins.
    Ian Collins, Oct 28, 2007
    #2
    1. Advertising

  3. Re: error: expected constructor, destructor, or type conversion before'<' token

    On 2007-10-28 19:44, wrote:
    > hi, i have used the queue library file and try to use the template as


    What do you mean with "used the queue library file"? Do you mean that
    you have included <queueu>? If that is the case then you should not try
    to define any of its methods. If not then you have to be more specific
    about your problem. Try posting the *minimal* amount of code that
    displays the problem.

    --
    Erik Wikström
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=, Oct 28, 2007
    #3
  4. wrote:
    > hi, i have used the queue library file and try to use the template as
    >
    > template <class QueueItem>
    > queue <QueueItem>::~queue() // line 25
    > {
    >
    > }
    >
    > template <class QueueItem>
    > void queue<QueueItem>::push(const QueueItem& entry) // line 42
    > {
    >
    > }
    >
    >
    >
    > error: expected constructor, destructor, or type conversion before '<'
    > token
    > queue.template:25: error: expected `;' before '<' token
    >
    > queue.template:42: error: expected init-declarator before '<' token
    > queue.template:42: error: expected `;' before '<' token
    >
    >
    > can u help out to slove this problem


    Yes, we think we can. Post the _complete_ code.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Oct 28, 2007
    #4
  5. Kai-Uwe Bux Guest

    wrote:

    > hi, i have used the queue library file and try to use the template as
    >
    > template <class QueueItem>
    > queue <QueueItem>::~queue() // line 25
    > {
    >
    > }
    >
    > template <class QueueItem>
    > void queue<QueueItem>::push(const QueueItem& entry) // line 42
    > {
    >
    > }
    >
    >
    >
    > error: expected constructor, destructor, or type conversion before '<'
    > token
    > queue.template:25: error: expected `;' before '<' token
    >
    > queue.template:42: error: expected init-declarator before '<' token
    > queue.template:42: error: expected `;' before '<' token
    >
    >
    > can u help out to slove this problem


    a) First, please hit the FAQ on how to post code that has problems.

    b) Without a reasonable amount of context, it is very hard to help. In
    particular, keep in mind that the compiler reports code at the moment of
    detection. That can be far beyond the actual position of the error.

    c) Just a wild guess: could it be that you have a (class) declaration before
    line 24 that misses a semicolon at the end?


    Best

    Kai-Uwe Bux
    Kai-Uwe Bux, Oct 28, 2007
    #5
  6. Guest

    On Oct 28, 4:05 pm, Kai-Uwe Bux <> wrote:
    > wrote:
    > > hi, i have used the queue library file and try to use the template as

    >
    > > template <class QueueItem>
    > > queue <QueueItem>::~queue() // line 25
    > > {

    >
    > > }

    >
    > > template <class QueueItem>
    > > void queue<QueueItem>::push(const QueueItem& entry) // line 42
    > > {

    >
    > > }

    >
    > > error: expected constructor, destructor, or type conversion before '<'
    > > token
    > > queue.template:25: error: expected `;' before '<' token

    >
    > > queue.template:42: error: expected init-declarator before '<' token
    > > queue.template:42: error: expected `;' before '<' token

    >
    > > can u help out to slove this problem

    >
    > a) First, please hit the FAQ on how to post code that has problems.
    >
    > b) Without a reasonable amount of context, it is very hard to help. In
    > particular, keep in mind that the compiler reports code at the moment of
    > detection. That can be far beyond the actual position of the error.
    >
    > c) Just a wild guess: could it be that you have a (class) declaration before
    > line 24 that misses a semicolon at the end?
    >
    > Best
    >
    > Kai-Uwe Bux


    Try to write template class <> instead...
    , Nov 5, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Preben
    Replies:
    6
    Views:
    3,865
    Preben
    Sep 20, 2006
  2. Damien
    Replies:
    5
    Views:
    14,668
    Damien
    Dec 13, 2006
  3. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    This is an unexpected token. The expected token is 'NAME'

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Jul 13, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    763
    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=
    Jul 13, 2007
  4. algatt
    Replies:
    2
    Views:
    604
    John Harrison
    Jul 19, 2007
  5. mhubbard
    Replies:
    0
    Views:
    3,430
    mhubbard
    Apr 4, 2008
Loading...

Share This Page