• Advertisement
Sign in to follow this  

Undefined base class?

This topic is 3325 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
	float rotate_amount;
	asteroid_type asteroid_size;


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



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
	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;

	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

	D3DXVECTOR2 get_position();
	void move();

	float get_rotation();
	void rotate(float);

	//Sprite Instance
	SpriteInstance get_sprite_instance();

	void update_velocity();
	D3DXVECTOR2 get_velocity();

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

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

	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();

	void change_speed(float);
	float get_speed();

	object_type get_object_type();

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



Share this post

Link to post
Share on other sites
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