Vector/List weirdness

Started by
4 comments, last by medevilenemy 14 years, 10 months ago
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
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.
Advertisement
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.
Post your code snippet
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.
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.
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?
Yeah, probably a good bet.
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.

This topic is closed to new replies.

Advertisement