473,486 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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 '07 #1
5 7955
am******@gmail.com 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.
Oct 28 '07 #2
On 2007-10-28 19:44, am******@gmail.com 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
Oct 28 '07 #3
am******@gmail.com 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
Oct 28 '07 #4
am******@gmail.com 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
Oct 28 '07 #5
On Oct 28, 4:05 pm, Kai-Uwe Bux <jkherci...@gmx.netwrote:
amitm...@gmail.com 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 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1825
by: sarah | last post by:
I keep getting the following error: g++ SortedList.cpp SortedList.cpp:260: error: expected constructor, destructor, or type conversion before '*' token SortedList.cpp:260: error: expected `,' or...
5
5656
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
2
1922
by: Suneeel | last post by:
Hi all, I'm new at templates. I've written this code and am compiling it with gcc 4.1.0 on RedHat Linux 9. /////////temptest.h////////////// template <class T> class tempclass { public:
9
9540
by: Trent | last post by:
Here is the error while using Visual Studio 2005 Error 1 error LNK2019: unresolved external symbol "void __cdecl print(int,int,int,int,int,int,int,int)" (?print@@YAXHHHHHHHH@Z) referenced in...
2
3076
by: brasewel | last post by:
Hi guys, I'm getting an error i cannot figure. Here is my code Header file ------------------------------------------------------------------------------------------- #ifndef Clock_H #define...
1
2791
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
13
3384
by: edyam | last post by:
I'm trying to template a pointer-based list class and several functions (the ones in which I try to return a pointer) are producing error messages. The class: template <typename T> class List...
2
3517
by: parvtb | last post by:
I have the following code: #include <list> using namespace std; template <typename T> list<T>::iterator doStuff( list<T>::iterator myIter ) //--error here
3
3979
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string;...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.