Hello World Runtime Error "Floating Point Division By Zero"

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
KrisG
Posts: 6
Joined: Wed Jul 16, 2014 9:23 pm

Hello World Runtime Error "Floating Point Division By Zero"

Post by KrisG »

Hi,

So I'm very new to Irrlicht and I'm trying to get an idea of it with the tutorials. I am stuck on the first one though. I'm using Borland XE2 to build and run, and I have copied everything and changed my include paths and all, but I'm getting a runtime error "Floating Point Division By Zero". No clue why. It's happening at the line

Code: Select all

 
               smgr->drawAll();
 

Below is a larger scope of the area around it, for reference. I have no idea why it's giving me that error and I can't find anything relevant online (the only real "hit" is a topic from 2004, and it's of no help). Any ideas?

Code: Select all

 
    while(device->run())
    {
        driver->beginScene(true, true, SColor(255,100,101,140));
 
        smgr->drawAll();
        guienv->drawAll();
 
        driver->endScene();
    }
 
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Hello World Runtime Error "Floating Point Division By Ze

Post by Seven »

"I'm using Borland XE2 to build and run"

might need more info to help you out.

did you recompile Irrlicht using the Borland XE2 compiler?
and if so, did you copy the dll into the program directory?
KrisG
Posts: 6
Joined: Wed Jul 16, 2014 9:23 pm

Re: Hello World Runtime Error "Floating Point Division By Ze

Post by KrisG »

Irrlicht.DLL? That's in there. I even moved it to the main folder from it's original place. I took the code sample right off of the page.

Below is the code I am running. Again...it should be just like the example. I took out most of the comments for readability, but left in the comment about linking the dll and the lib. What other information should I provide to help troubleshoot this?

Code: Select all

 
#include <irrlicht.h>
 
using namespace irr;
 
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
/*
To be able to use the Irrlicht.DLL file, we need to link with the Irrlicht.lib.
We could set this option in the project settings, but to make it easy, we use a
pragma comment lib for VisualStudio. On Windows platforms, we have to get rid
of the console window, which pops up when starting a program with main(). This
is done by the second pragma. We could also use the WinMain method, though
losing platform independence then.
*/
 
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
 
int main()
{
    IrrlichtDevice *device =
        createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
            false, false, false, 0);
 
    if (!device)
        return 1;
 
    device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
 
    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* smgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();
 
    guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
        rect<s32>(10,10,260,22), true);
 
    IAnimatedMesh* mesh = smgr->getMesh("C:/TestingIrrlicht/sydney.md2");
    if (!mesh)
    {
        device->drop();
        return 1;
    }
    IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
 
    if (node)
    {
        node->setMaterialFlag(EMF_LIGHTING, false);
        node->setMD2Animation(scene::EMAT_STAND);
        node->setMaterialTexture( 0, driver->getTexture("C:/TestingIrrlicht/sydney.bmp") );
    }
 
    smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
 
    while(device->run())
    {
        driver->beginScene(true, true, SColor(255,100,101,140));
 
        smgr->drawAll();
        guienv->drawAll();
 
        driver->endScene();
    }
 
    device->drop();
 
    return 0;
}
 
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Hello World Runtime Error "Floating Point Division By Ze

Post by Seven »

so you recompiled irrlicht.lib and moved the corresponding irrlicht dll to the correct directory?
I dont think that you can use the 'as shipped' irrlicht.lib and irrlicht.dll which is compiled under a different compiler.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Hello World Runtime Error "Floating Point Division By Ze

Post by CuteAlien »

I fear Irrlicht no longer compiles under Borland. The problem is simply that they don't offer a free version anymore of a current c++ compiler. The only free version is very outdated and 30 day versions don't help us much (well, they would help once for 30 days I guess...). Please pressure the vendor (whoever owns it now) to release at least a free compiler (don't care about the IDE) so opensource libraries can start supporting them again. They are digging their own grave with their current policy...
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
KrisG
Posts: 6
Joined: Wed Jul 16, 2014 9:23 pm

Re: Hello World Runtime Error "Floating Point Division By Ze

Post by KrisG »

Ah, I was afraid of that. I literally spent days on that wondering what I was doing wrong. Thanks!
Post Reply