"Hello World!" tutorial will not compile

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
RFilyaw
Posts: 2
Joined: Sun Feb 18, 2007 2:55 pm

"Hello World!" tutorial will not compile

Post by RFilyaw »

Hi. I'm new to the forums, and I've been searching for a week for a suitable gaming engine for my upcoming projects.

I started out by downloading the engine and sources. I followed the directions carefully on assigned the correct directories, and carefully copied the code (while reading it thoroughly for comprehension, of course).

The problem is, quite simply, if I try to compile my project in either VC++ Express, or VC++ 6.0, neither will compile and I receive the same errors. I also tried adding the .CPP file included, as well as pasting the contents of it to my .CPP file. Below, I will show my project layout, code and errors and hope that someone might help me.

I searched the forums to no avail.

I must admit, it's been a while since I've programmed in C++, and I very much hope to get back into the swing of things. Thank you very much.

(If it matters, I'm using Windows XP home edition, VC++ 8.0 and VC++ 6.0)

Code: Select all

#include "irrlicht.h"
#include "stdafx.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_SOFTWARE, 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"Hello World! This is the Irrlicht Software engine!", rect<int>(10,10,200,22), true);

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(255,100,101,140));
	smgr->drawAll();
	guienv->drawAll();
	driver->endScene();
}

	device->drop(); return 0;
}

Link to my Build Log.htm (errors)

Below are my layout, libary directory reference and include directory reference.
Image
Image
Image[/code]

Again, thank you very much for any help you can provide.
Last edited by RFilyaw on Sun Feb 18, 2007 8:02 pm, edited 1 time in total.
area51
Posts: 338
Joined: Thu Mar 18, 2004 10:20 pm
Location: UK
Contact:

Post by area51 »

You need to create a 'device' first, you have cut too much code out of the 'Hello World' tutorial.

I would copy the code verbaitim until you can get it to compile, then play around with it.
________
Persian recipes
Last edited by area51 on Fri Feb 25, 2011 12:11 am, edited 1 time in total.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Actually, it looks like you removed the using namespace irr; and friends at the top of the file. Save yourself a ton of trouble and just use the project and source for one of the examples. It is correct as-is.

Travis
RFilyaw
Posts: 2
Joined: Sun Feb 18, 2007 2:55 pm

Post by RFilyaw »

I appreciate the replies. I actually pasted the wrong code into my post, though it was correct and verbatim in my source.

Regardless, I was able to open and convert the example, which compiled and started without a problem. (Not sure why I couldn't get it to work before) I'll play around with it more.

Thanks.
Post Reply