What's wrong with my code?

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
Kordman916
Posts: 23
Joined: Sat Apr 03, 2010 3:44 am

What's wrong with my code?

Post by Kordman916 »

I've programmed in other languages before but I seem to be having some trouble with C++.

I've constructed a simple code to make sure that I could get Irrlicht to display a basic window with the title "Irrlicht engine".

Code: Select all

//This is the sourcecode for My project
//Programmed by Kordell Washington
//Started on Aug 10, 2010
//---------------------------------------

//Includes (Don't require a semi-colon at the end)
#include <irrlicht.h>
#include <iostream>

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

//Main loop
    int main()
    {
        //Create the device to handle the renderer, resolution, shadows, vsync, etc.
        Irrlichtdevice *device =
            createdevice( video::EDT_OPENGL, dimension2d<s32>(1024, 768), 32,
                    true, true, false, 0);

        if (!device)
            return 1;

        //Change the window title to the name of the program
        device->setwindowcaption(L"Earth Angels - Beta 0.1");

        IVideoDriver* device = device->getvideodriver();
        ISceneManager* smgr = device->getscenemanager();
        IGUIEnviroment* guienv = device->getguienviroment();

        while(device->run())
        {}

        device->drop();

        return 0;
    }
yet every time I try to compile and run in code::blocks I get this error.

Code: Select all

||=== Irrlicht Example 02 Quake Map, Linux ===|
/home/kordell/Irrlicht/examples/02.Quake3Map/main.cpp||In function ‘int main()’:|
/home/kordell/Irrlicht/examples/02.Quake3Map/main.cpp|22|error: ‘Irrlichtdevice’ was not declared in this scope|
/home/kordell/Irrlicht/examples/02.Quake3Map/main.cpp|22|error: ‘device’ was not declared in this scope|
/home/kordell/Irrlicht/examples/02.Quake3Map/main.cpp|24|error: ‘createdevice’ was not declared in this scope|
/home/kordell/Irrlicht/examples/02.Quake3Map/main.cpp|34|error: ‘IGUIEnviroment’ was not declared in this scope|
/home/kordell/Irrlicht/examples/02.Quake3Map/main.cpp|34|error: ‘guienv’ was not declared in this scope|
||=== Build finished: 5 errors, 0 warnings ===|
Why is it giving me these errors? I've been able to compile all of the examples with no problem but now I can't even compile this code.

I'm using Ubuntu 9.10 with Code::Blocks 8.02
loki1985
Posts: 214
Joined: Thu Mar 31, 2005 2:36 pm

Post by loki1985 »

well, kordell:

for starters C++ is case sensitive, means: there is no Irrlichtdevice, but IrrlichtDevice instead...
Kordman916
Posts: 23
Joined: Sat Apr 03, 2010 3:44 am

Post by Kordman916 »

That was all I needed after going around and making sure everything was how it should be I got my code to work thanks.
Post Reply