I am using Code::Blocks and Mingw32 with the SDL libraries. The error appears at line 13 of my code (commented below).
After some searching I believed it to be a missing semicolon(;), this doesn’t appear to be the case here though. Additional research threw up the fact that it may be an error in an include file.
Unfortunately there are no errors in the includes and even when the include is commented out this error persists. When the enum block is commented out the error jumps to the end of the class declaration.
#ifndef _TILE_H_
#define _TILE_H_
#include "Define.h"
enum
{
TILE_TYPE_NONE = 0,
TILE_TYPE_GROUND,
TILE_TYPE_RAMPUP,
TILE_TYPE_RAISED,
TILE_TYPE_RAMPDOWN
}; //error occurs here (line 13)
class Tile
{
public:
int TileID;
int TypeID;
public:
Tile();
};
#endif
This actually started happening after adding a new class, however the new class is completely unrelated and does not use, include or inherit from the posted one at all.
Any advice or information would be really appreciated.
EDIT (adding Define.h):
#ifndef _DEFINE_H_
#define _DEFINE_H_
#define MAP_WIDTH 40
#define MAP_HEIGHT 40
#define TILE_SIZE 16
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
#endif
You have a file with this:
In
Something.h, you have this:You are missing a semicolon, so the compiler sees:
Which is one declaration containing two types (a
classand anenum), which is not allowed. The semicolon is required afterclass,struct, andenumbecause you can declare instances of a new type in the same declaration as the type:(Also, names starting with
_and a capital letter are reserved. UseTILE_Hinstead of_TILE_H_.)