• Advertisement
Sign in to follow this  

Class header declared vector is unidentified?

This topic is 2055 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

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:

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

[/s]

[s]I

in my ZombieManager.cpp

ZombieManager::ZombieManager(int initZombiesSize = 50)
{

int nOfZombies = 0; //Works perfectly well

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

}


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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement