Standardized queue Template class error in VS.

Started by
2 comments, last by kinglink 19 years, 2 months ago
I keep getting the following error c:\project\Nog\Board.h(46): error C2143: syntax error : missing ';' before '<' On that file this is the surrounding lines
Quote: CString Name; private : queue<Space* > places; //error }; //end of class
I do have #include <queue> in the file. I've seen it typed similar to that in every file I've seen (Space is defined as a class) so why does that error come up? In addition, would you suggest using CString, if not using the MFC (using DirectX) or should I just use Char* or is there a preferable class?
Advertisement
Quote:Original post by kinglink
I keep getting the following error c:\project\Nog\Board.h(46): error C2143: syntax error : missing ';' before '<'

On that file this is the surrounding lines

Quote:
CString Name;
private :
queue<Space* > places; //error

}; //end of class


I do have #include <queue> in the file.

I've seen it typed similar to that in every file I've seen (Space is defined as a class)

so why does that error come up?


Could be a matter of the order in which you have things down. More context (like, a minimal complete file that demonstrates the problem) would be helpful.

Quote:In addition, would you suggest using CString, if not using the MFC (using DirectX) or should I just use Char* or is there a preferable class?


Look at the signature.
have you got a using statement above that somewhere? otherwise the code should be
std::queue< Space* > places;


(although this probably isn't the problem, as if it was your compiler should've also told you that 'queue' is undeclared...)
I give up, I can't figure out the code. I'll post my class (it's a bit long but I've tried commenting out everything and it still does it so it's likely a stupid thing)

Quote:deleted


As for std::string I couldn't seem to get it working at all, most documents on the web seem to state it's string functions but there's no actual std::String (I remember using string but then I've been doing too much Java so I might be getting mixed up)? Or if I use std::string that'll work with <string>. I'll use that puppy.

std::queue works perfectly well, I feel like an idiot, but I'm calling it a learning experience.

P.S. Second edit :This is why I don't like to edit posts, you get both sides. The final info is Both are working fine, now thank you very much. Though likely I'll make my own Queue class this helps for first builds.

[Edited by - kinglink on February 13, 2005 4:34:09 PM]

This topic is closed to new replies.

Advertisement