Cannot open include file irrlicht

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
RockViper
Posts: 6
Joined: Mon Jul 07, 2008 7:30 pm

Cannot open include file irrlicht

Post by RockViper »

I need some help. I have been trying to build a sollution, the project is the simple hello world irrlicht app. I cannot get the solution to compile without the error:

fatal error C1083: Cannot open include file: 'irrlicht': No such file or directory

Ok, so I know how to set my include and lib directories, and I did that from the start. I even pointed to two directories each having a copy of irrlicht.h. I have checked them and rechecked them and they are correct but VC++2008 still says cannot find irrlicht.h header file.

Im eager to get started with Irrlicht. I was checking out ogre, which I was able to compile with no errors the first time I compiled, but the examples that come with it are VERY SLOW(often 4 to 2 fps). So I tried Irrlicht and WOW, the speed diffference is amazing(1000 fps on one demo, 100fps on multianimation demo with 65 animated characters on screan)! I wanna get started now!

Somebody tell me what Im doin wrong please, thank you.

Heres a pic to help you in giving me advice

Image
Baz
Posts: 11
Joined: Fri Jul 04, 2008 12:03 pm

Post by Baz »

try to include "irrlicht.h" instead of "irrlicht" ;)
RockViper
Posts: 6
Joined: Mon Jul 07, 2008 7:30 pm

Post by RockViper »

Thanks for the advice but I've already tried that. In Visual Studio 8 you don't put .h after header files, you just use #include <irrlicht>. Using #include <irrlicht.h> gives 69 errors. Its wierd, I have checked everything, #include <irrlicht> is the correct way to include, thats how i included header files with the ogre sdk and never had a problem.

Im sorry I mean Visual Studio 9, which is Visual Studio 2008
Last edited by RockViper on Mon Jul 07, 2008 9:06 pm, edited 2 times in total.
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

rogerborg is the special agent for this kind of work.

please wait, he's busy at the moment.

he'll be around shortly.

thanks,

Image
Image
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

RockViper wrote:Thanks for the advice but I've already tried that. In Visual Studio 8 you don't but .h after header files, you just use #include <irrlicht>. Using #include <irrlicht.h> gives 69 errors. Its wierd, I have checked everything, #include <irrlicht> is the correct way to include, thats how i included header files with the ogre sdk and never had a problem.
In my projects in 2008, I always use #include <irrlicht.h>. Just to check, I went and changed it to #include <irrlicht>, and I got the fatal file doesn't exist error. Add the .h and post the errors you get; they are probably unrelated.
pera
Posts: 460
Joined: Wed May 14, 2008 1:05 pm
Location: Novi Sad, Serbia
Contact:

Post by pera »

69 nine errors is a progress compared to "can't find irrlich.h"
Tell us first of 69 and lets get starting.
RockViper
Posts: 6
Joined: Mon Jul 07, 2008 7:30 pm

Post by RockViper »

Thanks for the help. Im not sure about the <.h> being required, I believe you it's just that I remember while trying to compile some code from the book Sams Teach Yourself C++ in 24 hours(source written for VC++6) and the code wouldnt compile, seems like the solution was a combination of dropping <.h> from header files and also using, using namespace std;. I would love it if you would say, "I told you so" pointing out a solution and help me compile the code :lol: Below is the source im trying to compile and following that are the errors generated when I try to build the solution.

Code: Select all


#include <irrlicht.h>

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

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

	device->setWindowCaption(L"Hey BItches! - 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;

}


1>------ Build started: Project: Tutorial_1, Configuration: Release Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>Hello.cpp
1>.\Hello.cpp(3) : error C2146: syntax error : missing ';' before identifier 'irr'
1>.\Hello.cpp(3) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\Hello.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hello.cpp(3) : error C2365: 'irr' : redefinition; previous definition was 'namespace'
1>.\Hello.cpp(4) : error C2146: syntax error : missing ';' before identifier 'core'
1>.\Hello.cpp(4) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\Hello.cpp(4) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hello.cpp(5) : error C2146: syntax error : missing ';' before identifier 'scene'
1>.\Hello.cpp(5) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\Hello.cpp(5) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hello.cpp(6) : error C2146: syntax error : missing ';' before identifier 'video'
1>.\Hello.cpp(6) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\Hello.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hello.cpp(7) : error C2146: syntax error : missing ';' before identifier 'io'
1>.\Hello.cpp(7) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\Hello.cpp(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hello.cpp(8) : error C2146: syntax error : missing ';' before identifier 'gui'
1>.\Hello.cpp(8) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\Hello.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hello.cpp(12) : error C2065: 'IrrlichtDevice' : undeclared identifier
1>.\Hello.cpp(12) : error C2065: 'device' : undeclared identifier
1>.\Hello.cpp(13) : error C2065: 'EDT_SOFTWARE' : undeclared identifier
1>.\Hello.cpp(13) : error C2065: 'dimension2d' : undeclared identifier
1>.\Hello.cpp(13) : error C2065: 's32' : undeclared identifier
1>.\Hello.cpp(13) : error C3861: 'createDevice': identifier not found
1>.\Hello.cpp(16) : error C2065: 'device' : undeclared identifier
1>.\Hello.cpp(16) : error C2227: left of '->setWindowCaption' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(18) : error C2065: 'IVideoDriver' : undeclared identifier
1>.\Hello.cpp(18) : error C2065: 'driver' : undeclared identifier
1>.\Hello.cpp(18) : error C2065: 'device' : undeclared identifier
1>.\Hello.cpp(18) : error C2227: left of '->getVideoDriver' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(19) : error C2065: 'ISceneManager' : undeclared identifier
1>.\Hello.cpp(19) : error C2065: 'smgr' : undeclared identifier
1>.\Hello.cpp(19) : error C2065: 'device' : undeclared identifier
1>.\Hello.cpp(19) : error C2227: left of '->getSceneManager' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(20) : error C2065: 'IGUIEnvironment' : undeclared identifier
1>.\Hello.cpp(20) : error C2065: 'guienv' : undeclared identifier
1>.\Hello.cpp(20) : error C2065: 'device' : undeclared identifier
1>.\Hello.cpp(20) : error C2227: left of '->getGUIEnvironment' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(22) : error C2065: 'guienv' : undeclared identifier
1>.\Hello.cpp(22) : error C2227: left of '->addStaticText' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(23) : error C2065: 'rect' : undeclared identifier
1>.\Hello.cpp(23) : error C2062: type 'int' unexpected
1>.\Hello.cpp(25) : error C2065: 'IAnimatedMesh' : undeclared identifier
1>.\Hello.cpp(25) : error C2065: 'mesh' : undeclared identifier
1>.\Hello.cpp(25) : error C2065: 'smgr' : undeclared identifier
1>.\Hello.cpp(25) : error C2227: left of '->getMesh' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(26) : error C2065: 'IAnimatedMeshSceneNode' : undeclared identifier
1>.\Hello.cpp(26) : error C2065: 'node' : undeclared identifier
1>.\Hello.cpp(26) : error C2065: 'smgr' : undeclared identifier
1>.\Hello.cpp(26) : error C2227: left of '->addAnimatedMeshSceneNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(26) : error C2065: 'mesh' : undeclared identifier
1>.\Hello.cpp(28) : error C2065: 'node' : undeclared identifier
1>.\Hello.cpp(30) : error C2065: 'node' : undeclared identifier
1>.\Hello.cpp(30) : error C2227: left of '->setMaterialFlag' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(30) : error C2065: 'EMF_LIGHTING' : undeclared identifier
1>.\Hello.cpp(31) : error C2065: 'node' : undeclared identifier
1>.\Hello.cpp(31) : error C2227: left of '->setFrameLoop' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(32) : error C2065: 'node' : undeclared identifier
1>.\Hello.cpp(32) : error C2227: left of '->setMaterialTexture' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(32) : error C2065: 'driver' : undeclared identifier
1>.\Hello.cpp(32) : error C2227: left of '->getTexture' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(35) : error C2065: 'smgr' : undeclared identifier
1>.\Hello.cpp(35) : error C2227: left of '->addCameraSceneNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(35) : error C3861: 'vector3df': identifier not found
1>.\Hello.cpp(35) : error C3861: 'vector3df': identifier not found
1>.\Hello.cpp(37) : error C2065: 'device' : undeclared identifier
1>.\Hello.cpp(37) : error C2227: left of '->run' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Hello.cpp(37) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://c:\Users\Eric\Documents\Visual Studio 2008\Projects\Tutorial_1\Release\BuildLog.htm"
1>Tutorial_1 - 69 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
RockViper
Posts: 6
Joined: Mon Jul 07, 2008 7:30 pm

Post by RockViper »

I tried looking up where I found the info about dropping the <.h> from header files in VS9 but all I could find was this youtube video showing a simple tutorial that uses #include <header> instead of #include <header.h>

http://www.youtube.com/watch?v=9CfnN98UK5g

and another showing the include without .h

http://www.metacafe.com/watch/1257193/v ... _lesson_1/

Thanks for helping me get this solved. Just justifing my reasoning behind dropping the .h.
night_hawk
Posts: 153
Joined: Mon Mar 03, 2008 8:42 am
Location: Suceava - Romania
Contact:

Post by night_hawk »

The "without .h" thingy is for standardized headers :D

iostream, fstream, vector, map are examples of headers that used to have .h at their ending in older times, but now are used without. Why? No idea :P
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

namespace is misspelled in all of those (namepsace). If you fix that, it should work.

Also, what you must have been thinking of is #include <iostream>, you don't use a .h there, and you also use the namespace std.
RockViper
Posts: 6
Joined: Mon Jul 07, 2008 7:30 pm

Post by RockViper »

Excuse the language in the code, Its not directed to you guys, it was an attempt at humor, didn't think anyone was gonna see the code :lol:

I knew it was some dumb mistake I made lol, thanks guys, awesome help. Can you believe I didn't notice the mispelling of namespace lol, or the fact that it must be mispelled because it was not highlighted as a keyword lol. Im embarrassed but greatful :P

If ya don't mind, I did as you said and now I am left with only 2 errors, help me out please.

Here comes the source, then the errors.

Code: Select all


#include <irrlicht.h>

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

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

	device->setWindowCaption(L"Hey BItches! - 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;

}


1>------ Build started: Project: Tutorial_1, Configuration: Release Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>Hello.cpp
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
1>Hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *,char const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@PBD@Z) referenced in function _main
1>Release\Tutorial_1.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Eric\Documents\Visual Studio 2008\Projects\Tutorial_1\Release\BuildLog.htm"
1>Tutorial_1 - 2 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
RockViper
Posts: 6
Joined: Mon Jul 07, 2008 7:30 pm

Post by RockViper »

I think I figured it out. I had omitted the line #pragma comment(lib, "Irrlicht.lib") while trying to figure out what I was doing wrong, read somewhere that you shouldnt do it like that, anyways. Thanks for you help, very fast response :!:

I would like to recomend some awesome books for you guys.

Wordware - Programming Game AI By Example
AI Game Engine Programming

I think I like AI Game Engine Programming a little better because it seems "deeper" in its knowledge. It touches on the psychology aspect of programming AI engines, very good stuff. I recomend both.

Thanks again!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

dlangdev wrote:rogerborg is the special agent for this kind of work.
That poacher B@z got there 30 seconds before me, so I had to delete my post. Then the rest of you selfish fudge-knuckles mopped up the sloppy seconds. How's a borg supposed to have some fun when this forum is infested with people who actually want to help? I can't believe that the giddy heights of comp.os.linux.answers has devolved into this; constructive feedback.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

rogerborg wrote:That poacher B@z got there 30 seconds before me, so I had to delete my post.
You mean - that happened to you too? Lol. He was up to lots of answers ;-)
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
Baz
Posts: 11
Joined: Fri Jul 04, 2008 12:03 pm

Post by Baz »

hahaaa, i was faster than you xD
Post Reply