Sign in to follow this  
lodoss118

adding class to header?

Recommended Posts

why won't this work? I keep getting this error, error C2027: use of undefined type 'ObjectSprite'

#ifndef LEVEL_H
#define LEVEL_H

#include "SimpleSprite.h"
//#include "ObjectSprite.h"

enum levelLayers{
	LAYER1, LAYER2, LAYER3, LAYER4, LAYER5,
	LAYER6, LAYER7, LAYER8, LAYER9, LAYER10,
};

class ObjectSprite;

class Level
{
public:
		Level(string name);
		~Level();

		SimpleSprite *getSprite(const int SPRITE_ID);
		MaskingBox *getBLayer(const int layer);

		string getName();
		float getStartX(); //start of level
		float getEndX();   //end of level

		virtual void scrollX(float speed, int dirX=0);
		virtual void scrollY(float speed, int dirY=0);
		virtual void levelQuake(bool t, float height, float speed, int time)=0;
		void higherView(ObjectSprite *follow, float speed);

		virtual void update()=0;
		virtual void drawBackLayer()=0;
		virtual void drawMiddleLayer()=0;
		virtual void drawFrontLayer()=0;

private:
		string levelName;
		
protected:
		vector<SimpleSprite *> sprite;
		vector<MaskingBox *> bLayer;
		float startX, endX;
};

extern Level *pLevel;

#endif


Share this post


Link to post
Share on other sites
Does the compiler error actually occur within the header file, and if so, which line? I would expect the one use of ObjectSprite in the header to be fine, since it is merely a pointer. However, if you try to do something with that pointer within the source file, but still don't include "ObjectSprite.h" within that source file, then you will indeed get this error.

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