Page 1 of 1

Can't this code working :(

Posted: Fri Aug 13, 2004 12:30 pm
by shadowFX
I can't get this code to compile and i have tryed to fix it but i can't.

main.cpp:

Code: Select all

#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")

int main()
{
	//Creating the Irrlicht Engine Device
	IrrlichtDevice *device =
					createDevice(EDT_SOFTWARE, dimension2d<s32> (512, 384), 16, false, false, 0);
	
	//Setting the Window's Title
	device->setWindowCaption(L"Hello World - This is a Irrlicht Engine Test");

	//Storing a Pointer to the Video Driver
	IVideoDriver* driver = device->getVideoDriver();
	//Storing a Pointer to the Scene Manager
	ISceneManager* smgr = device->getSceneManager();
	//Storing a Pointer to the GUI
	IGUIEnviroment* guienv = device->getGUIEnvironment();

	//Adding some text
	guienv->addStaticText(L"Hello World - This is a Irrlicht Engine Test",
			rect<int>(10,10,200,30, true);

	//Making a while loop to display everything to the screen
	while(device->run())
	{
		//Clearing the screen
		driver->beginScene(true, true, SColor(0,100,100,100));

		//Drawing Content
		smgr->drawAll();
		guienv->drawAll();

		//Calling content to the screen
		driver->endScene();
	}//While

	//Deleting Content on the screen
	device->drop();
    return 0;
} //int main

Compiler errors:
------ Build started: Project: Irrlicht_Demo, Configuration: Release Win32 ------

Compiling...
hello-world_demo.cpp
hello-world_demo.cpp(46) : fatal error C1010: unexpected end of file while looking for precompiled header directive

Build log was saved at "file://c:\Documents and Settings\shadow\My Documents\Visual Studio Projects\Irrlicht_Demo\Release\BuildLog.htm"
Irrlicht_Demo - 1 error(s), 0 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped

Can anyone help me?

Thanks in advanced

Posted: Fri Aug 13, 2004 12:39 pm
by cinek
How about closing parenthesis in this line:

Code: Select all

//Adding some text 
   guienv->addStaticText(L"Hello World - This is a Irrlicht Engine Test", 
         rect<int>(10,10,200,30, true);

Posted: Fri Aug 13, 2004 7:29 pm
by T101
You could change the project settings so that it does not use precompiled headers. Maybe then you'll get a proper error message about that line.

Obviously that function call's parentheses must be closed. It's just that I would expect an error about an "unexpected token ;" or something. Oh well, maybe it's the precompiler.
Definitely close the parentheses.

Posted: Fri Aug 13, 2004 9:20 pm
by shadowFX
i finally got it working :) I added the bracket in and changed the predifined headers in the project settings and i got a couple more errors. The error was i forgot to put a n in IGUIEnviroNment (when i was declaring a pointer), so now it compiles. Thank you for ur help :)