Hello World tutorial and VC++ 2003 IDE problem

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
blewisjr

Hello World tutorial and VC++ 2003 IDE problem

Post by blewisjr »

Ok I did the Hello World tutorial in the Visual Studio 2003 IDE. I moved the md2 and bmp files to a appropriate directory and set the path for the app to load them from. When I run the exe through the IDE in Debug mode the console tells me that it can't load sydney.md2 file. However, when I run the exe outside of the IDE everything loads like it is suppose to. What is going on here? Here is the code just incase you need it.

Code: Select all

#include<irrlicht.h>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#pragma comment(lib, "Irrlicht.lib")

int main()
{
	IrrlichtDevice* device = createDevice(EDT_DIRECTX9, dimension2d<s32>(512, 384), 16, false, false, false, 0);

	device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	guienv->addStaticText(L"Irrlicht DX9 Render", rect<int>(10, 10, 200, 32), false);

	IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);

	if(node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setFrameLoop(0, 310);
		node->setMaterialTexture(0, driver->getTexture("../media/sydney.bmp"));
	}

	smgr->addCameraSceneNode(0, vector3df(0, 30, -40), vector3df(0, 5, 0));

	while(device->run())
	{
		driver->beginScene(true, true, SColor(0, 200, 200, 200));
		smgr->drawAll();
		guienv->drawAll();
		driver->endScene();
	}

	device->drop();
	return 0;
}
tobing
Posts: 9
Joined: Wed Aug 24, 2005 5:59 pm
Location: Germany / Heidelberg
Contact:

Post by tobing »

Probably the wrong directory structure. If you run the app from within the IDE, the working (current) directory is NOT where the exe resides, but one level up (if you didn't change the default settings).

Please post some more details about your directories to confirm this conjecture...
blewisjr

Post by blewisjr »

Yea my directory structure is default I only added the include and lib dir of Irrlicht to the C++ Global Directories so they are available for any project I start up. I took poke around and I can't find anything that tells me where visual studio runs the exe from.
Post Reply