Sign in to follow this  

Vector/List weirdness

This topic is 3110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

This topic is 3110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this