unhandeled exception in barebones??

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aburt11
Posts: 66
Joined: Sun Jan 15, 2012 10:27 am

unhandeled exception in barebones??

Post by aburt11 »

hey there,
my irrlicht game engine is off to a bad start.
i dont understand why it is giving me an unhandeled exception at runtime. any thoughts?

main.h

Code: Select all

 
#ifndef MAIN_H_
#define MAIN_H_
 
#include <irrlicht.h>
 
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
 
//globals
 
class RedNovember
{
public:
        RedNovember();   // constructor
        void initIrrlicht();
        void renderScene();
        int shutdown();
        IrrlichtDevice* getDevice() { return device; }
private:
        IrrlichtDevice* device; 
        IVideoDriver* driver;
        ISceneManager* smgr;
        IGUIEnvironment* guienv;
 
        // every other global you would need can instead of being global just be put in here. 
          
};
 
 
#endif
 
main.cpp

Code: Select all

 
#include "main.h"
 
RedNovember* sys;
 
void RedNovember::renderScene()
{
        while(device->run())
        {
                driver->beginScene(true,true,SColor(255,100,101,140));
                smgr->drawAll();
                guienv->drawAll();
                driver->endScene();
        }
}
 
int RedNovember::shutdown()
{
        device->drop();
        return 0;
}
 
int main()
{
        sys->initIrrlicht();
 
 
        sys->renderScene();
 
        sys->shutdown();
 
}
 
initialize.cpp

Code: Select all

 
#include "main.h"
 
 
void RedNovember::initIrrlicht()
{
        device = createDevice(EDT_OPENGL, dimension2d<u32>(800, 600), 32,
                false, false, false, 0);
 
        device->setWindowCaption(L"Project: Red November");
 
        driver = device->getVideoDriver();
        smgr = device->getSceneManager();
        guienv = device->getGUIEnvironment();
 
}
 
please help :)
 
 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: unhandeled exception in barebones??

Post by CuteAlien »

You never seem to create an object for your RedNovember class. So in your first call "sys->initIrrlicht();" you tell the compiler that sys points to a valid object, while in reality you never initialized sys and it only points into a random place in memory.

Classes are only descriptions of the structure. You still have to create actual objects in memory, for example with "new" to create it on the heap.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
aburt11
Posts: 66
Joined: Sun Jan 15, 2012 10:27 am

Re: unhandeled exception in barebones??

Post by aburt11 »

hmm thats not it :(
im still getting the error
Error 1 error LNK2001: unresolved external symbol "class redNovember SYS" (?SYS@@3VredNovember@@A) C:\Users\adam\documents\visual studio 2010\Projects\RedNovember\RedNovember\main.obj
kaliber
Posts: 117
Joined: Sat Jan 17, 2009 12:51 pm

Re: unhandeled exception in barebones??

Post by kaliber »

Code: Select all

int main()
{
        sys = new RedNovember();
        sys->initIrrlicht();
 
 
        sys->renderScene();
 
        sys->shutdown();
 
}
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: unhandeled exception in barebones??

Post by hybrid »

You declared but never implemented the constructor. So it's missing in the obj files.
Post Reply