Skip to main content
gamedev.net
🔒 Locked

c++ vector

Started by Mr_Ridd Jun 11, 2004 at 2:03 PM 3 replies 300+ views
Original Post
Mr_Ridd
Mr_Ridd
Howzit When I use a vector it says throes an error. This is what I declare: vector allAnimsList(50); ...and the error: error C2065: ''vector'' : undeclared identifier error C2062: type ''int'' unexpected I have included vector in my source file. It''s a *.cpp file. What could be the problem? It doesn''t have any problem including the file. I''m declaring it within a method. Shot
The ability to succeed is the ability to adapt
bytecoder
bytecoder
Make sure you have you tell the compiler vector is in the std namespace, e.g:

#include <vector>

// method 1 (not recommended unless you''re lazy)

using namespace std;

vector<type> v;

// method 2 (better than method 1)

using std::vector;

vector<type> v;

// method 3 (about the same as method 2)

std::vector<type> v;
Mr_Ridd
Mr_Ridd
Shot

It works like a beast now.
The ability to succeed is the ability to adapt
Tylon
Tylon
Indeed, the infamous vector is a ferocious beast.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.