所以我一直在使用C :: B中的Irrlicht引擎,但我认为我没有正确链接的东西。当我构建我的项目时,我收到一个错误:
-------------- 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))
我不知道这是否是我错误或什么关联的事情。我也将提供我的源代码,这非常类似于我从中获得的示例。
#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;
}
任何帮助将不胜感激。
答案 0 :(得分:0)
显然,行Process terminated with status 1
表示您的createDevice函数在此行失败:
if(device==0) return 1;
您的构建不会因状态1而终止,因为您的问题标题声称,构建成功,您的执行已经开始,然后执行以此状态终止
为什么不使用获取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
}