Click here to Skip to main content
11,640,125 members (71,302 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ Visual-Studio
did anyone ever got this case ??
it's driving me crazy , can't understand where is the error !!
first I thought it could be in the header file , I checked it , no ';' is missing
#ifndef _ERRLIST_H_
#define _ERRLIST_H_
#include <queue>
#include <string>
struct errorStruct{
				int errLineNum;
				int errColNum ;
				string errMessage;
queue <errorstruct> errQueue; //error points here 
class ErrList
	void pushError(int line,int col,string message);
	void popError();	
	void printErrors();
	int getSize();
Posted 14-May-11 1:01am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I see two problems:

First you define queue<errorstruct> instead of queue<errorStruct>
Secondly, string and queue are in the std namespace. Write std::string and std::queue instead.
Richard MacCutchan at 14-May-11 9:02am
Well spotted, I spent a few minutes staring at the code and not seeing it. :(
fresh_girl at 14-May-11 14:42pm
the first one is totally a typing error ^^'
can't believe I didn't see it that I'm missing std , I guess I didn't sleep much last night
thanks a lot for ur answer
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Like mcbain said the error you are getting is a non descriptive one from the compiler. It basically means the compiler cannot locate any class / struct or declaration by the name of queue, thus it is expecting it to be a variable which should be followed by a ;.

You could fix this by adding
#using std;
Or like mcbain suggested by adding std:: before the usage of the queue type (std::queue.
Member 10120089 at 30-Jul-13 5:49am
I have the same problem but I am working with C and not with C++. So i can not use std. Same one have a solution for this .

Thank you
Philippe Mori at 20-Nov-13 18:38pm
No # before using in C++.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I had the similar issue what I found was that my header files contains cyclic reference. For instance I have a base class like below:

#include "OtherClass.h"
class BaseClass {
     OtherClass* otherClass;

In OtherClass.h, I was referencing "BaseClass.h" file that was causing the issue.

Hope that might help you.
Muhammad Masood
[blog link removed]
CHill60 at 20-Nov-13 8:08am
I rather hope that in 2 and a half years the OP had fixed his problem!!
phil.o at 20-Nov-13 8:17am
Why answering a question that has been answered and marked as solved for more than two years now?
Are you trying to discretely post links to your blog?
yeswekey at 22-Jul-14 6:06am
Thanks for sharing the reason, but you didn't mention the solution. Anyway here is what I did:

// in A.h
class A {
B b;
C c;

// In B.h
class A; // This solved it and don't include A.h
class B{
A *parent;

// in C.h
class A; // Here too.
class C{
A *parent;

Now in B.cpp and C.cpp , include A.h and continue coding.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 20 Nov 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100