Possible en double:
variable or field declared voidvariable ou champ `generateMonster » déclarée nulle
Je travaille sur un projet d'obtenir quelques problèmes avec une fonction. Je continue d'avoir une erreur que je connais signifie que je n'ai jamais déclaré un type, mais je sais que je suis. Tous les fichiers ont .h et .cpp inclus, donc je n'ai aucune inclusion manquante.
c'est la fonction que je l'appelle avec - la question est le generateMonster
int room1(charType& heroObj) {
int r;
roomType RoomObj;
RoomObj.generateMonster(heroObj);
cout << "There's a hiss as you open this door, and you smell a sour odor, like something rotten or fermented. Inside you see a small room lined with dusty shelves, crates, and barrels. It looks like someone once used this place as a larder, but it has been a long time since anyone came to retrieve food from it." << endl;
cout << endl << "Room #1:\n 1. Door in the East corner of the North wall.\n 2. Door in the middle of the East wall.\n 3. Door in the east corner of the south wall.\n 4. Door in the West corner of the South wall.\n" << endl;
doIt();
cin >> r;
if (!cin.good())
cout << "That is not a valid option. Please try again.";
cin.clear();
cin.ignore(100, '\n');
system("cls");
switch(r) {
case 1:
genDoor();
hallway1(heroObj);
break;
case 2:
genDoor();
hallway4(heroObj);
break;
case 3:
genDoor();
hallway3(heroObj);
break;
case 4:
genDoor();
hallway2(heroObj);
break;
}
}
mon prototype
class roomType
{
public:
roomType();
void generateMonster(charType& heroObj);
void generateTreasure();
private:
int gold;
int potion;
int keys;
};
et ma fonction dans son ensemble - http://pastie.org/4799752
Mis à jour pour inclure .h –
Vous devriez peut-être copier/coller le message d'erreur exact. – CrazyCasta
J'ai vu ça, mais mon type déclaré n'est pas un membre de std :, mais une classe. –