Sign in to follow this  

C++ class not being recognised

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

In my map.h
#ifndef __MAPS_H__
#define __MAPS_H__
#include "tile.h"
#include <vector>

class Map
{
public:
	Map();
	~Map();

	void FreeResources();
	void SetGeneric(); //setup a generic map
	void Draw();
	char *GetName()   {return _filename;}
	void Load(const char *file);
	void PlaceTile(Tile *tile, int type, int x, int y);
	void DeleteTile(int type, int x, int y);
	void SetDraw(bool draw);

private:
	char _filename[STRING_SIZE];
	bool _draw;
	bool _drawGUI;
	std::vector<Tile> _tiles;
};

extern Map g_Map;

#endif

Tile is not being recognised by the compiler. tile.h
#ifndef __TILE_H__
#define __TILE_H__
#include "main.h"

enum TileType
{
	PATH = 0,
	WALL = 1
};

class Tile
{
public:
	Tile();

	void SetBitmap(HBITMAP pic)		{_image = pic;}
	void SetFileName(char *name)	{strcpy(_filename, name);}
	void SetType(char type)			{_type = type;} 
	void SetCoords(int x, int y)	{_coords.x = x; _coords.y = y;}
	void SetIndex(int x, int y)		{_index.x = x; _index.y = y;}

	HBITMAP GetBitmap()		{return _image;}
	char *GetFileName()		{return _filename;}
	char  GetType()			{return _type;}
	POINT GetCoords()		{return _coords;}
	POINT GetIndex()		{return _index;}

	bool Solid()			{ return _solid;}

	// The set function for the tile class
	void SetSolid(bool value)		{_solid = value;}

private:
	HBITMAP _image;
	char    _filename[STRING_SIZE];//image to load
	char	_type;
	POINT   _coords;
	POINT	_index;
	bool	_solid; //wall?
};

#endif

I cannot figure out why it saying: Tile: unidentified identifier. syntax error: identifier Tile.

Share this post


Link to post
Share on other sites
I had a feeling that was the problem..
here's the top of main.h

#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
#include "player.h"
#include "gfx.h"
#include "input.h"
#include "defines.h"
#include "logger.h"
#include "maps.h"


extern HINSTANCE g_hInstance;
extern HWND g_hWnd;
extern Logger Log;

Share this post


Link to post
Share on other sites

This topic is 3743 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.

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