Vector/List weirdness
Not sure what the matter is... I keep trying to create an STL vector (#include <vector>), but every time I try I get the error: "expected `,' or `;' before '<' token". I've even tried vector<int> blah just as a simplistic test and I get the same error. What might be causing this? Thanks again
Vector and list are in the standard namespace so you have to do one of the following. Use std::vector each time you declare a vector or at the top of the file type using std::vector; so that you can omit the namespace declaration each time you declare a vector. Finally, you can also type using namespace std; to let you use all the features of the std namespace without having to type std:: each time.
Edit: I am just assuming this is what your problem is since you didn't post any code.
Edit: I am just assuming this is what your problem is since you didn't post any code.
Ah, that did it, thanks. I somehow got away without using the namespace in an earlier project... weird. Sorry for the omission of a code snippet.
Quote:Original post by medevilenemy
I somehow got away without using the namespace in an earlier project.
Maybe some other header that you included was using namespace std?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement