Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
2.06/5 (4 votes)
See more:
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 <queue> , 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
{

	public:
	void pushError(int line,int col,string message);
	void popError();	
	void printErrors();
	int getSize();

};
#endif
</errorstruct></string></queue>
Posted

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:

C
#include "OtherClass.h"
class BaseClass {

   protected:
     OtherClass* otherClass;
}



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


Hope that might help you.
Thanks,
Muhammad Masood
[blog link removed]
 
Share this answer
 
v2
Comments
CHill60 20-Nov-13 8:08am    
I rather hope that in 2 and a half years the OP had fixed his problem!!
phil.o 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 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.
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.
 
Share this answer
 
Comments
Member 10120089 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 20-Nov-13 18:38pm    
No # before using in C++.
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.
 
Share this answer
 
v2
Comments
Richard MacCutchan 14-May-11 9:02am    
Well spotted, I spent a few minutes staring at the code and not seeing it. :(
fresh_girl 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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900