473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

i am having a hard time with stl queue

i thought it would be kinda cool to use stl queue in my c++ program. however, it turns out stl queue is not happy with me...

i have a header, and I have declared the queue as

queue<int> q;

and please do note that i have used #include <queue> too
but it would still not recognize queue as a class, it would tell me "error: expected constructor, destructor, or type conversion before '<' token"

do i need to do anything else other than what I mentioned to use STL queue?

btw i am using g++ to compile my program
Apr 12 '07 #1
5 2072
gpraghuram
1,275 Expert 1GB
Hi,
Have u added the statement after the using namespace std;
#include<queue>

Use this way
Expand|Select|Wrap|Line Numbers
  1. #include<queue>
  2. using namespace std;
  3.  
Thanks
Raghuram
Apr 12 '07 #2
Hi,
Have u added the statement after the using namespace std;
#include<queue>

Use this way
Expand|Select|Wrap|Line Numbers
  1. #include<queue>
  2. using namespace std;
  3.  
Thanks
Raghuram
I did use the statement include <queue> before using namespace std;
Apr 12 '07 #3
gpraghuram
1,275 Expert 1GB
HI,
If possible can u post the code....

Thanks
raghuram
Apr 12 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
You say you have a HEADER that contains:

queue<int> q;

????

Header files are not to contain code but only declarations. If you have queue<int> in a header AND IF the header is included before <queue>, then you will get a compile error.

Do not put variables in header files.

This compiles fine:

#include <iostream>
#include <queue>
using namespace std;
int main()
{
queue<int> q;

return 0;
}
Apr 12 '07 #5
hi ...
it would be helpful if you put in the code you have for your question ... :)


i thought it would be kinda cool to use stl queue in my c++ program. however, it turns out stl queue is not happy with me...

i have a header, and I have declared the queue as

queue<int> q;

and please do note that i have used #include <queue> too
but it would still not recognize queue as a class, it would tell me "error: expected constructor, destructor, or type conversion before '<' token"

do i need to do anything else other than what I mentioned to use STL queue?

btw i am using g++ to compile my program
May 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

77
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
14
by: Gregory L. Hansen | last post by:
I can't seem to make a queue of objects, using the STL queue. I'm trying to make a little event manager, and I just want someplace to store events. The method definitions for EventManager have...
5
by: Erich Schreiber | last post by:
In the Python Library Reference the explanation of the time.sleep() function reads amongst others: > The actual suspension time may be less than that requested because > any caught signal will...
4
by: Julia | last post by:
Hi, So my server is complete,I have all the code and libraries which I need but now I want to add exception management and logging capabilities I would like you to suggest a good book about...
8
by: Vmz | last post by:
HI, I got two queues, I need to write void function that would check both queues and remove from first queue all nodes that matches second queue. Each node has two pointers that shows to previous...
1
by: Carl Griffin | last post by:
I am working an an application to enumerate users and permissions they have to read certain fax queues on a fax server. The problem I am having is that I can't figure out a way to let the admin...
9
by: Michael.Suarez | last post by:
void RaiseMyObjectsClickEvent(string btn_name) { //Raise btn_name.Click } Could someone please help me fill in the rest? Thanks,
6
by: rh0dium | last post by:
Hi Experts!! I am trying to get the following little snippet to push my data to the function func(). What I would expect to happen is it to print out the contents of a and loglevel. But it's...
1
by: James Mills | last post by:
On 10/7/08, James Mills <prologic@shortcircuit.net.auwrote: Out of curiosity I modifed my bench marking tool for my event/component library (pymills) and here are the results: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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...

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.