Jump to content
  • Advertisement
Sign in to follow this  
Antonym

Undefined base class?

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

I get this error 1>c:\documents and settings\david\mis documentos\visual studio 2005\projects\dungeon\dungeon\asteroid.h(13) : error C2504: 'Object' : base class undefined with the following code, I have no idea what's causing it, what does this sort of error refer to?
#ifndef ASTEROID_H
#define ASTEROID_H

enum asteroid_type{SMALL, MEDIUM, LARGE};

#include <d3d9.h>
#include <d3dx9.h>
#include "Object.h"
#include "Application.h"
#include "Game.h"

class Asteroid: public Object
{
private:
	float rotate_amount;
	asteroid_type asteroid_size;

public:
	Asteroid(D3DXVECTOR2, 
			 float, 
			 Application&,
			 std::string,
			 int,
			 int,
			 int, 
			 int,
			 int,
			 float,
			 asteroid_type);

	void update(Game&);
	void handle_collision(Game&, Object&);
	void handle_death(Game&);

};

#endif

Object class
#ifndef OBJECT_H
#define OBJECT_H

class Object;

#include <d3d9.h>
#include <d3dx9.h>
#include "SpriteInstance.h"
#include "Game.h"
#include <vector>

enum object_type{SHIP, MISSILE, ASTEROID, EFFECT};

class Object
{
private:
	D3DXVECTOR2 position;
	float rotation;
	SpriteInstance sprite_instance;
	D3DXVECTOR2 velocity;
	int radius;
	int mass;
	DWORD time_since_last_shot;
	DWORD cooldown;
	int impact_damage;
	int hit_points;
	bool hit_animation;
	float speed;
	object_type type;

public:
	//Constructors
	Object(D3DXVECTOR2, //position 
		   float, //rotation
		   Sprite*, //sprite
		   int, //size
		   int, //radius
		   int, //mass
		   int, //impact_damage
		   int, //hit points
		   float, //speed,
		   object_type); //object_type

	//Position
	D3DXVECTOR2 get_position();
	void move();

	//Rotation
	float get_rotation();
	void rotate(float);

	//Sprite Instance
	SpriteInstance get_sprite_instance();

	//Velocity
	void update_velocity();
	D3DXVECTOR2 get_velocity();

	//Cooldown
	void set_time_since_last_shot(DWORD);
	DWORD get_time_since_last_shot();
	DWORD get_cooldown();

	//Collision
	void collision_check(Game&, std::vector<Object*>&);
	void check_collision(Game&, Object&);
	virtual void handle_collision(Game&, Object&) =0;

	//Damage
	void damage(int);
	void check_death(Game&);
	virtual void handle_death(Game&) =0;
	void play_death(Game&);
	int get_impact_damage();

	//Hit Animation
	void play_hit(Game&);
	void set_hit_animation(bool);
	bool get_hit_animation();

	//Speed
	void change_speed(float);
	float get_speed();

	//Type
	object_type get_object_type();

	//Extra
	virtual void update(Game&) =0;
	float degrees_to_radians(float);

};

#endif

Share this post


Link to post
Share on other sites
Advertisement
Well I don't use a master header, I had heard before it could cause trouble. Although I think it did have something to with that. The game class included asteroid class and vice versa. Found a solution though, I moved the enum back to the game.h so that I could remove the asteroid include. I was wondering where should enums go in a project?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!