Not compiling

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
IrrGamer
Posts: 22
Joined: Fri Oct 05, 2007 3:30 am

Not compiling

Post by IrrGamer »

Ok I don't know what I did wrong, and I'm asking yall cause all of you know everything about Irrlicht functions... This is the code:

Code: Select all

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

using namespace irr;

int main() {
	IrrlichtDevice* device = createDevice(EDT_SOFTWARE, dimension2d<s32>(512, 384), 32, false, false, false, 0);
	device->setWindowCaption(L"Let's See if this works...");
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnviroment* guienv = device->getGUIEnviroment();

	guienv->addStaticText(L"HELLO WORLD!!! DOES THIS WORK?", rect<int>(10,10,200,22), true);

	while(device->run()) {
		driver->beginScene(true, true, SColor(255,100,101,140));

		smgr->drawAll();
		guienv->drawAll();

		driver->endScene;
	}
	device->drop();
	return 0;
}
And this is the compiler error:

Code: Select all

1>------ Build started: Project: SoLv1, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(3) : error C2871: 'irr' : a namespace with this name does not exist
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(6) : error C2065: 'IrrlichtDevice' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(6) : error C2065: 'device' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(6) : error C2065: 'EDT_SOFTWARE' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(6) : error C2065: 'dimension2d' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(6) : error C2065: 's32' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(6) : error C3861: 'createDevice': identifier not found
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(7) : error C2065: 'device' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(7) : error C2227: left of '->setWindowCaption' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2065: 'IVideoDriver' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2065: 'driver' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2065: 'device' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2227: left of '->getVideoDriver' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(9) : error C2065: 'ISceneManager' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(9) : error C2065: 'smgr' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(9) : error C2065: 'device' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(9) : error C2227: left of '->getSceneManager' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(10) : error C2065: 'IGUIEnviroment' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(10) : error C2065: 'guienv' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(10) : error C2065: 'device' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(10) : error C2227: left of '->getGUIEnviroment' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2065: 'guienv' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2227: left of '->addStaticText' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2065: 'rect' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2062: type 'int' unexpected
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : error C2065: 'device' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : error C2227: left of '->run' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://c:\Documents and Settings\Bijadi Rao\My Documents\Visual Studio 2008\Projects\SoLv1\SoLv1\Debug\BuildLog.htm"
1>SoLv1 - 28 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
UGH :evil: Why can't I even put up TEXT on screen??? :(
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

It doesn't look like you've even included irrlicht.h, or did you just miss that out of the code snippet you posted?

Seems like that's the problem
Image Image Image
IrrGamer
Posts: 22
Joined: Fri Oct 05, 2007 3:30 am

Post by IrrGamer »

Umm that's it, I should've checked before I posted, shouldn't I? Thanks JP.
IrrGamer
Posts: 22
Joined: Fri Oct 05, 2007 3:30 am

Post by IrrGamer »

EDIT: No wait... It's giving more messages...

Code: Select all

1>------ Build started: Project: SoLv1, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2065: 'EDT_SOFTWARE' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2065: 'dimension2d' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(8) : error C2275: 'irr::s32' : illegal use of this type as an expression
1>        c:\documents and settings\bijadi rao\desktop\irrlicht-1.4beta\include\irrtypes.h(43) : see declaration of 'irr::s32'
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(10) : error C2065: 'IVideoDriver' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(10) : error C2065: 'driver' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(11) : error C2065: 'ISceneManager' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(11) : error C2065: 'smgr' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2065: 'IGUIEnviroment' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2065: 'guienv' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(12) : error C2039: 'getGUIEnviroment' : is not a member of 'irr::IrrlichtDevice'
1>        c:\documents and settings\bijadi rao\desktop\irrlicht-1.4beta\include\irrlichtdevice.h(39) : see declaration of 'irr::IrrlichtDevice'
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : error C2065: 'guienv' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : error C2227: left of '->addStaticText' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : error C2065: 'rect' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(14) : error C2062: type 'int' unexpected
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(17) : error C2065: 'driver' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(17) : error C2227: left of '->beginScene' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(17) : error C3861: 'SColor': identifier not found
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(19) : error C2065: 'smgr' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(19) : error C2227: left of '->drawAll' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(20) : error C2065: 'guienv' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(20) : error C2227: left of '->drawAll' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(22) : error C2065: 'driver' : undeclared identifier
1>c:\documents and settings\bijadi rao\my documents\visual studio 2008\projects\solv1\solv1\main.cpp(22) : error C2227: left of '->endScene' must point to class/struct/union/generic type
1>        type is ''unknown-type''
1>Build log was saved at "file://c:\Documents and Settings\Bijadi Rao\My Documents\Visual Studio 2008\Projects\SoLv1\SoLv1\Debug\BuildLog.htm"
1>SoLv1 - 23 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
After I included the Irrlicht.h...


I have another idea. Can someone create a VC++ project with Irrlict all the DLL's etc in it so newbies like me can just download the sample project and work on our game? That way there won't be so many annoying topics like mine asking how to INSTALL Irrlict let alone how to work it.

Then we can download the project (which includes Irrlicht) and work on our game right after clicking on the sample project file. That'll seem to solve all installation topics, right?
Cristiano87
Posts: 13
Joined: Wed Oct 03, 2007 9:00 am
Location: Milano, Italia

Post by Cristiano87 »

Errors
EDT_SOFTWARE: use video::EDT_SOFTWARE
dimension2d: use core::dimension2d
...

you should read about c++ and namespaces, and see the irrlicht documentation to choose the proper namespace
or
put this in your code just below #include:
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

There are plenty of sample projects in the examples folder and in the tutorial section on the website.
Image Image Image
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

You need some more namespaces. After using namespace irr you can add:

Code: Select all

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
The ready-to compile projects do already exist. Just check the examples (in the examples folder of the engine). Lots of nice project, all written to help you get started :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
WWW
Posts: 26
Joined: Thu Oct 04, 2007 1:41 pm

Post by WWW »

And another 2 mistakes
First mistake :
Type Environment with "N" not Enviroment
IGUIEnvironment* guienv = device->getGUIEnvironment();

And the second mistake is here:
You forgot to put "()"
driver->endScene();
EDIT: ohh and here : #pragma comment(lib,"Irrlicht.dll") should be "irrlicht.lib" :shock:
IrrGamer
Posts: 22
Joined: Fri Oct 05, 2007 3:30 am

Post by IrrGamer »

OMG it works!!! YESSS!!!!!

WOW you guys are really helpful! The Ogre 3d community would probably call me noob or loser or something, but you guys are nice.

I can FINALLY work on my project! YEAH! :D
Post Reply