-2

So I've been playing around with the Irrlicht engine in C::B but I don't think I have things linked correctly. When I build my project, I get one error:

-------------- Build: Linux in First Game (compiler: GNU GCC Compiler)---------------

Target is up to date.
Nothing to be done (all items are up-to-date).


-------------- Run: Linux in First Game (compiler: GNU GCC Compiler)--    -------------

Checking for existence: /home/administrator/Desktop/First Game/bin/Debug/First Game
Executing: /home/administrator/Desktop/First\ Game/bin/Debug/First\ Game  (in /home/administrator/Desktop/First Game/.)
Process terminated with status 1 (0 minute(s), 0 second(s))

I don't know if it's something I have linked wrong or what. I will provide my source code too, which is very much like the example I got it from.

#include </home/administrator/Desktop/irrlicht1.8.3/include/irrlicht.h>
#include <iostream>


using namespace irr;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif




int main()
{
video::E_DRIVER_TYPE driverType;

printf("Please select the driver you want for this example:\n"\
    " (a) OpenGL 1.5\n (b) Direct3D 9.0c\n (c) Direct3D 8.1\n"\
    " (d) Burning's Software Renderer\n (e) Software Renderer\n"\
    " (f) NullDevice\n (otherKey) exit\n\n");

char i;
std::cin >> i;

switch(i)
{
    case 'a': driverType = video::EDT_OPENGL;   break;
    case 'b': driverType = video::EDT_DIRECT3D9;break;
    case 'c': driverType = video::EDT_DIRECT3D8;break;
    case 'd': driverType = video::EDT_BURNINGSVIDEO;break;
    case 'e': driverType = video::EDT_SOFTWARE; break;
    case 'f': driverType = video::EDT_NULL;     break;
    default: return 1;
}

IrrlichtDevice *device =
    createDevice(driverType, core::dimension2d<u32>(640,480));

if(device==0)
    return 1;

video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();

device->getFileSystem()->addFileArchive("/home/administrator/Desktop/irrlicht-1.8.3/ascension.pk3");

scene::IAnimatedMesh* mesh = smgr->getMesh("ascension.bsp");
scene::ISceneNode* node = 0;

if (mesh)
    node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);

if (node)
    node->setPosition(core::vector3df(-1300,-144,-1249));

smgr->addCameraSceneNodeFPS();

/*
The mouse cursor needs not be visible, so we hide it via the
irr::IrrlichtDevice::ICursorControl.
*/
device->getCursorControl()->setVisible(false);


int lastFPS = -1;

while(device->run())
{
    if (device->isWindowActive())
    {
        driver->beginScene(true, true, video::SColor(255,200,200,200));
        smgr->drawAll();
        driver->endScene();

        int fps = driver->getFPS();

        if (lastFPS != fps)
        {
            core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
            str += driver->getName();
            str += "] FPS:";
            str += fps;

            device->setWindowCaption(str.c_str());
            lastFPS = fps;
        }
    }
    else
        device->yield();
}

device->drop();
return 0;
}

Any help would be appreciated.

  • 1
    You should try running the executable from a terminal window, so you can see what errors are output (if any). Alternatively, debug it using GDB. – Mark Bessey Feb 17 '16 at 18:58

1 Answers1

0

Obviously, the line Process terminated with status 1 indicate that your createDevice function failed at this line: if(device==0) return 1;

Your build is not terminated with status 1 as the title of your question claims, the build have succeed, your execution has started and then the execution is terminated with this status

Why not use the official way of getting the irrlicht driver:

#include "driverChoice.h"
int main()
{
     video::E_DRIVER_TYPE driverType=driverChoiceConsole();
    if (driverType==video::EDT_COUNT)
        return 1;

// create device

IrrlichtDevice* device = createDevice(driverType,
        core::dimension2d<u32>(640, 480), 16, false, false, false);

if (device == 0)
    return 1; // could not create selected driver.
//your code + irrlicht loop
}
Irrmich
  • 436
  • 4
  • 15