Error : Compile Irrlicht With Dev C++ ?

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
andrei71
Posts: 9
Joined: Tue Apr 19, 2011 5:05 am

Error : Compile Irrlicht With Dev C++ ?

Post by andrei71 »

I have try to compiled Irrlicht with Dev C++ 4.9.9.2.i wrote a script to compiled it :

Code: Select all

// HelloUniverse.cpp
// Include the Irrlicht header
#include "irrlicht.h"

// Irrlicht Namespaces
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


int main()
{
    IrrlichtDevice *irrDevice = createDevice(EDT_SOFTWARE,
                                          dimension2d<s32>(512, 384),
                                          16,
                                          false,
                                          false,
                                          0);//->>ERROR LINE : 21
                                          
    irrDevice->setWindowCaption(L"Dev-C++ and the Irrlicht Engine!");
    
    IVideoDriver* irrDriver = irrDevice->getVideoDriver();
    ISceneManager* irrSceneMgr = irrDevice->getSceneManager();
    IGUIEnvironment* irrGUIEnv = irrDevice->getGUIEnvironment();

    irrGUIEnv->addStaticText(
            L"Hello World! This is the Irrlicht software engine!",
	        rect<int>(10,10,200,30), true, true, 0, -1);
    
    while(irrDevice->run())
    { 
        irrDriver->beginScene(true, true, SColor(0,192,192,192));
                
                irrSceneMgr->drawAll();
                irrGUIEnv->drawAll();
                
	    irrDriver->endScene();
	}
 
    irrDevice->drop();

    return(0);
}
But it was error when i compiled it :
C:\Dev-Cpp\irrdemo.cpp In function `int main()':
21 C:\Dev-Cpp\irrdemo.cpp invalid initialization of reference of type 'const irr::core::dimension2d<irr::u32>&' from expression of type 'irr::core::dimension2d<irr::s32>'
329 C:\irrlicht-1.7.2\irrlicht-1.7.2\include\irrlicht.h in passing argument 2 of `irr::IrrlichtDevice* irr::createDevice(irr::video::E_DRIVER_TYPE, const irr::core::dimension2d<irr::u32>&, irr::u32, bool, bool, bool, irr::IEventReceiver*)'
C:\Dev-Cpp\Makefile.win [Build Error] [irrdemo.o] Error 1
Looks like the error come from irrlicht header too.

I followed from this tutorial :
http://irrlicht.sourceforge.net/tut_devcpp.html

please help
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

The tutorial is outdated and so is Dev-C++. Switch to Visual Studio Express or Code::Blocks.

Anyways the error message is pretty clear on what is wrong. createDevice() now needs a dimension2d<u32> and you are passing a dimension2d<s32>
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

I second that!! I got rid of Dev last year...
Get Microsoft Visual... its also free and it works alot better.
code happens
andrei71
Posts: 9
Joined: Tue Apr 19, 2011 5:05 am

Post by andrei71 »

Code: Select all

Anyways the error message is pretty clear on what is wrong. createDevice() now needs a dimension2d<u32> and you are passing a dimension2d<s32>
I have change it from 2d<s32> to 2d<u32>.the compilation was ok but it became error when debugged.

Code: Select all

I second that!! I got rid of Dev last year...
Get Microsoft Visual... its also free and it works alot better.
I have tried Visual C++ 2008 express edition but i was fail to compiled it due to the lack off VC++ 2008 tutorial.do you know how to compile Irrlicht with another IDE with sufficient tutorials ?
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Where does the compilation with VS fail? Setting up irrlicht really isn't that hard, and the VS Express IDE's are really an excellent solution for development in windows
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

andrei71 wrote:

Code: Select all

Anyways the error message is pretty clear on what is wrong. createDevice() now needs a dimension2d<u32> and you are passing a dimension2d<s32>
I have change it from 2d<s32> to 2d<u32>.the compilation was ok but it became error when debugged.

Code: Select all

I second that!! I got rid of Dev last year...
Get Microsoft Visual... its also free and it works alot better.
I have tried Visual C++ 2008 express edition but i was fail to compiled it due to the lack off VC++ 2008 tutorial.do you know how to compile Irrlicht with another IDE with sufficient tutorials ?
Youtube tutorial

If you feel msvc is "too complex" for you then you could try other ides like: code::blocks, eclipse, netbeans.
Working on game: Marrbles (Currently stopped).
andrei71
Posts: 9
Joined: Tue Apr 19, 2011 5:05 am

Post by andrei71 »

Follwing to this tutorial :

http://irrlicht.sourceforge.net/tut001.html

The tutorial only teach about how to compile with VC++ 6 and VS.NET
.but there is no VC++ 2008 tutorial.

how to set it on ?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

CAN YOU GO TO THE LINK I GAVE YOU?
Working on game: Marrbles (Currently stopped).
andrei71
Posts: 9
Joined: Tue Apr 19, 2011 5:05 am

Post by andrei71 »

Sorry but the link you gave me,the explaination is too quick and small.i don't get it :(

Now i'm trying compile VC++ 2010 with irrlicht 1.7
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

VC++ 2008 has its own beginers help tutorial. Start there,
code happens
Virror
Posts: 191
Joined: Mon May 02, 2011 3:15 pm

Post by Virror »

I run VS2010, just tell me if you need any help : )
andrei71
Posts: 9
Joined: Tue Apr 19, 2011 5:05 am

Post by andrei71 »

Ok,i have tried VC++ 2008 express edition,these are my steps :

1.Download Irrlicht SDK and extract it
2.Open VC++ 2008>>File>>New Project>>Win32Project>>Latihan.cpp
3.Paste all Irrlicht headers in VC include folder
4.Paste Irrlicht.lib in VC library folder
5.Open Latihan properties in VC++2008>>Linker>>Input>>Additional Dependencies>>Insert Irrlicht.lib>>OK
6.Insert Irrlicht codes in Latihan.cpp :

Code: Select all

#include <irrlicht.h>

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

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

int main()
{
         IrrlichtDevice *device =
                createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
                        false, false, false, 0);

        if (!device)
                return 1;
        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 renderer!",
        rect<s32>(10,10,260,22), true);
        IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
        if (!mesh)
        {
                device->drop();
                return 1;
        }
        IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
        if (node)
        {
                node->setMaterialFlag(EMF_LIGHTING, false);
                node->setMD2Animation(scene::EMAT_STAND);
                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;
}
7.Paste Irrlicht.dll in system32
8.Build solution(success)
9.Debug
10.Fail to display :

Code: Select all

'Project.exe': Loaded 'C:\Documents and Settings\Acer\My Documents\Visual Studio 2008\Projects\Project\Debug\Project.exe', Symbols loaded.
'Project.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\Irrlicht.dll', Binary was not built with debug information.
'Project.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\glu32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\winmm.dll'
'Project.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
Irrlicht Engine version 1.7.2
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
'Project.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'Project.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME'
'Project.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\BtMmHook.dll'
'Project.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll'
BTMMHOOK 28.05.2011 11:11:17 Thread<0D50> Hook DLL loaded
Could not load mesh, because file could not be opened: : ../../media/sydney.md2
BTMMHOOK 28.05.2011 11:11:17 Thread<0D50> Hook DLL unloaded
The program '[632] Project.exe: Native' has exited with code 1 (0x1).
When it was debug,it's just displayed frame in a glance.and looks like i fail on the mesh :
Could not load mesh, because file could not be opened: : ../../media/sydney.md2
LizardGamer
Posts: 83
Joined: Fri May 28, 2010 8:59 am
Location: Perth, Australia

Post by LizardGamer »

If your doing what I did awhile ago, (which was compile and on you go), it doesn't work like that.

But I would say use code::blocks, it may look quite hard but it just takes sometime and then you can use it that easy
andrei71
Posts: 9
Joined: Tue Apr 19, 2011 5:05 am

Post by andrei71 »

Oh no,sorry for my dopost..this forum gave me some errors damn it !.please admin DELETE my post !
CuteAlien
Admin
Posts: 9934
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

NP, double posts removed ;-)

You don't have to copy around headers and libs for building. You can set additional include paths (for headers) and additional linker paths (for the lib) in your project settings. Then your compiler and linker will find them there.

What is important is to have data in the correct relative folder to your working directory. When your start from within VS then your working directory is by default in the same folder as your project files. When you start the .exe outside of VS then the working directory is identical to your .exe file. What I usually do is change that inside of VS - I don't know the name right now (I'm not on Windows), but you can say which folder should be used as working directory in your project settings and the easiest is usually to set that to the same output folder where your exe will be. Then on loading make sure the relative path to your media is correct from there on.
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
Post Reply