Sign in to follow this  
Crovea

Class header declared vector is unidentified?

Recommended Posts

Crovea    124
EDIT: NEVERMIND!! It seems my compiler was hiding the fact that it had a problem with vector not being a member of std. Sorry


[s]Hey i have a probably quick question.

I declared a vector<Zombie*> in my class header, but when i try to access it, i get the error that it's unidentified? This wierds me out as my other variables are perfectly accessible.

My class header:
[CODE]
class ZombieManager
{
public:
int ZombieHP;
int nOfZombies;
std::vector<Zombie*> zombies; //array of zombies!
}

[/CODE][/s]

[s]I

in my ZombieManager.cpp
[CODE]
ZombieManager::ZombieManager(int initZombiesSize = 50)
{

int nOfZombies = 0; //Works perfectly well

zombies.reserve(initZombiesSize); //error C2065 'zombies' : undeclared identifier
zombies = new std::vector<Zombie*>;

}
[/CODE]

Does anyone have an explanation/solution?[/s] Edited by crovea

Share this post


Link to post
Share on other sites

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