# Vector/List weirdness

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
Post your code snippet

##### Share on other sites
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.

##### Share on other sites
Quote:
 Original post by medevilenemyI somehow got away without using the namespace in an earlier project.

Maybe some other header that you included was using namespace std?

##### Share on other sites
Yeah, probably a good bet.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Forum Statistics

• Total Topics
627702
• Total Posts
2978712

• 21
• 14
• 12
• 10
• 12