Click here to Skip to main content
Rate this: bad
good
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
{
 
	public:
	void pushError(int line,int col,string message);
	void popError();	
	void printErrors();
	int getSize();
 
};
#endif
</errorstruct></string></queue>
Posted 14-May-11 2:01am
Rate this: bad
good
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.
  Permalink  
v2
Comments
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
good
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.
  Permalink  
Comments
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
good
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 {
 
   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]
  Permalink  
v2
Comments
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)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 Sergey Alexandrovich Kryukov 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 20 Nov 2013
Copyright © CodeProject, 1999-2014
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