473,696 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
+ 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>::~q ueue() // 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 7972
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>::~q ueue() // 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>::~q ueue() // 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>::~q ueue() // 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
1832
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 `;' before '*' token Line # 260 is ListNode *SortedList::copyList( ListNode *L ) { towards the end of the .cpp file. I have just put stubs in fr the code that I know works for readability purposes. here is my code:
5
5676
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
1933
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
9557
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 function _main assign2.obj Thanks a lot ! Here is the code:
2
3092
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 Clock_H #include <vector> #include <list>
1
2808
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 incorporate the same logic within my simulation, the class that implements the functor logic has problems compiling. I get the following errors: -- Building myTest.cpp --
13
3398
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 : public BasicADT { public: List(); // constructor
2
3535
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
3990
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; using std::cout; using std::endl;
0
8595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9142
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8875
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8849
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7699
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2313
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.