0

Trying to have my "layer" class, put 3 objects "drawObject", into it's vector, and getting out of scope error.

Everywhere I see they just do "vector >Class< vectorName"; and it works!

layer class:

#include <vector>
#include "DrawObject.h"

using namespace std;

class layer
{
    public:

        layer();
        virtual ~layer();

    private:

        vector<DrawObject> objects; <--------------- Error here! "'DrawObject' was not declared in this scope"
};

DrawObject class:

#include <SDL/SDL.h>
#include "AnimationSet.h"

class drawObject
{
    public:

        drawObject(char* name, char* surfaceFile, int xPos, int yPos, int drawLevel, bool willMoveVar, int animationNumber);
        drawObject(char* name, char* surfaceFile, int xPos, int yPos, int drawLevel, bool willMoveVar);
        virtual ~drawObject();
        SDL_Surface* loadImage(char* surfaceFile);
        SDL_Surface* getSurface();
        void setSurface(SDL_Surface* surface);
        char* getName();
        void setName(char* name);
        int getID();
        void setID(int ID);
        float getX();
        void addX(float xAdd);
        void setX(float xSet);
        float getY();
        void addY(float yAdd);
        void setY(float ySet);
        bool isSprite();
        void setIsSprite(bool isSprite);
        bool willMove();
        void setWillMove(bool willMove);
        bool draw();
        void setDraw(bool draw);

    private:

        SDL_Surface* surface = NULL; // Imagem, no caso de único sprite; caso contrário, spritesheet.
        char* name;
        int ID;
        float xPos;
        float yPos;
        bool isSpriteVar; // Se isSprite, imagem é spritesheet.
        bool willMoveVar;
        bool drawVar;

};
4

1 回答 1

2

vector<DrawObject> should be vector<drawObject>, no? C++ is case-sensitive, you defined the class drawObject but attempt to use DrawObject.

于 2013-01-05T17:17:59.507 回答