Jump to content
  • Advertisement
Sign in to follow this  
medevilenemy

Vector/List weirdness

This topic is 3300 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
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!