2016-02-17 1 views
-1

J'ai donc joué avec le moteur Irrlicht dans C :: B mais je ne pense pas avoir de choses liées correctement. Quand je construis mon projet, j'obtiens une erreur:Irrlicht build terminé avec le statut 1

-------------- 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)) 

Je ne sais pas si c'est quelque chose que j'ai lié mal ou quoi. Je vais aussi fournir mon code source, ce qui ressemble beaucoup à l'exemple que j'ai obtenu.

#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; 
} 

Toute aide serait appréciée.

+0

Vous devriez essayer d'exécuter l'exe coupable à partir d'une fenêtre de terminal, de sorte que vous pouvez voir quelles erreurs sont produites (le cas échéant). Vous pouvez également le déboguer à l'aide de GDB. –

Répondre

0

De toute évidence, la ligne Process terminated with status 1 indiquent que votre fonction createDevice a échoué à cette ligne: if(device==0) return 1;

Votre construction ne se termine pas avec le statut 1 le titre de vos revendications question, la construction ont réussir, votre exécution a commencé puis l'exécution se termine par ce statut

Pourquoi ne pas utiliser la voie officielle d'obtenir le pilote irrlicht:

#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 
}