I am fairly new to the C++ programming scene, so please do try and bear with me through this. I am attempting to write application and scene management classes for a small top-down space shooter, though when I compile the classes I am getting errors. While I am using the Irrlicht Device as a rendering engine, this is not an Irrlicht specific problem; or I do not believe so. If anyone can offer some sort of insight on this compile error, I would be extreamly greatful :)
Quote:
alexl@linux:~/development/projects/irrlicht2d/src> make
g++ main.cc -o irrlicht2d -I"../include" -I"/usr/X11R6/include" -L"/usr/X11R6/lib" -L"../lib/Linux" -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
In file included from main.cc:15:
system.h:23: error: ISO C++ forbids initialization of member `Game2D_Device'
system.h:23: error: making `Game2D_Device' static
system.h:23: error: invalid in-class initialization of static data member of
non-integral type `irr::IrrlichtDevice*'
system.h: In member function `int cGame2D::Create(irr::video::E_DRIVER_TYPE,
int, int, int, bool)':
system.h:45: error: `Game2D_Device' undeclared (first use this function)
system.h:45: error: (Each undeclared identifier is reported only once for each
function it appears in.)
system.h:46: error: `Game2D_Deivce' undeclared (first use this function)
system.h: At global scope:
system.h:52: error: declaration of `void cGame2D::Destroy()' outside of class
is not definition
system.h:53: error: syntax error before `{' token
In file included from main.cc:15:
system.h:57:7: warning: no newline at end of file
make: *** [all] Error 1
Quote:
//system.h
class cGame2D
{
protected:
irr::IrrlichtDevice* Game2D_Device = 0;
public:
cGame2D();
~cGame2D();
int Create(video::E_DRIVER_TYPE driver,int width,int height,int depth,bool screenMode);
int setScene(const char* scene);
void Destroy();
};
//---
int cGame2D::Create(video::E_DRIVER_TYPE driver,int width,int height,int depth,bool screenMode)
{
Game2D_Device = createDevice(driver,dimension2d<s32>(width,height),depth,screenMode,false,false,0);
if (Game2D_Deivce == 0)
{
return false;
}
}
void cGame2D::Destroy();
{
Game2D_Device->drop();
}