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

A

amitmool

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
 
I

Ian Collins

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.
 
G

Guest

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.
 
V

Victor Bazarov

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
 
K

Kai-Uwe Bux

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
 
R

rob.ahlberg

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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top