Help, scope error?

Hello. Currently I'm creating a text rpg, and I'm making containers to be used in the world, the problem is, I get errors when I try to compile and I have no idea why, these are the errors:

1
2
3
21 error: 'armor' was not declared in this scope
21 error: template argument 1 is invalid
21 error: template argument 2 is invalid


but for some reason, this is only with the armor vector, the weapons and potions vectors work fine.

CONTAINER CLASS HEADER
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef CONTAINER_H
#define CONTAINER_H
#include <string>
#include <vector>
#include <room.h>
#include <weapon.h>
#include <armor.h>
#include <potion.h>
#include <menus.h>
#include <spells.h>
#include <quest.h>

class container
{
    public:
        container();
    protected:
    private:
        int maxItems;
        vector <weapon> weapons;
        vector <armor> armors;
        vector <potion> potions;
};

#endif // CONTAINER_H


ARMOR CLASS HEADER
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef ARMOR_H
#define ARMOR_H
#include <string>
#include <vector>
#include <room.h>
#include <weapon.h>
#include <armor.h>
#include <potion.h>
#include <menus.h>
#include <spells.h>
#include <quest.h>

class armor // class for armor type items
{
    public:
        armor();
    protected:
    private:
        string name;
        enum type {chest, legs, helm};
        int defense;
        int weight;
};

#endif // ARMOR_H
Try adding #include <containers.h> to your armor file
nope, didnt work, on another note I'm getting the same error, except instead of with the armor class its with the container class in another class
You need to post the smallest possible complete program that illustrates your problem and then show the complete error messages. These messages have important information embedded within them to aid in locating and fixing the errors. For example the message should tell you the file and function where the error was detected.

Your container.h file should include the proper files that declare the armor, weapon, and potion classes.

You've got circular includes.
Include only what you must http://www.cplusplus.com/forum/articles/10627/#msg49679 (point 4)
Topic archived. No new replies allowed.