tons of undeclared first use of this function errors :/

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
Sard
Posts: 8
Joined: Tue Dec 09, 2008 1:19 pm

tons of undeclared first use of this function errors :/

Post by Sard »

Ok, I've been poking around irrlicht via Dev-C++ I managet to do something with it and something I did not, which is the problem.

Topic is a bit misleading since I already fixed tons of errors due to tutorial authors typos... Not mad about typos I learned a bit while correcting those and now I know where to look for help.

But this one confuses me too much so making a thread sounded like a nice idea.

Code in question:

Code: Select all

#include "irrlicht.h"
#include <Smaterial.h>
#include <iostream>

#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif

// 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_OPENGL,
                                          dimension2d<s32>(800, 600),
                                          32,
                                          false,
                                          false,
                                          0);
                                          
    irrDevice->setWindowCaption(L"Irrlicht 1.3.1");
    
    IVideoDriver* irrDriver = irrDevice->getVideoDriver();
    ISceneManager* irrSceneMgr = irrDevice->getSceneManager();
    ISceneManager* smgr = irrDevice->getSceneManager();
    
    irrDevice->getFileSystem()->addZipFileArchive("/media/pptp.pk3");
    
    IAnimatedMesh* mesh = smgr->getMesh("maps/gauntlet.bsp");
    ISceneNode* node = 0;
    
    if (mesh)
    node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 128);
    if (node)
    node->setPosition(core::vector3df(-1300,-144,-1249));
    
    
          smgr->addCameraSceneNodeFPS();
          irrDevice->getCursorControl()->setVisible(false);
             
    while(irrDevice->run())
    { 
        irrDriver->beginScene(true, true, SColor(0,100,125,125));          
                irrSceneMgr->drawAll();
                irrGUIEnv->drawAll();
	    irrDriver->endScene();
	}
 
    irrDevice->drop();

    return(0);
}
While compiling this it says that "undeclared first use of blah blah 'irrGUIEnv'

Which is a bit odd, since it works on the tutorial to make a window without declaring it and with the same header files aswell.

Any help?

ps. The .pk3 file is in the .exe files subfolder called /media and the .bsp is in /maps folder in .pk3 are those ok?
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

First, stop using Dev-C++. It's totally outdated and is no longer in development. Switch to Code::Blocks for example.

The error says that the compiler doesn't know about an object named 'irrGUIEnv' because you didn't define one.

Put this somewhere after the createDevice call:

Code: Select all

IGUIEnvrionment* irrGUIEnv = irrDevice->getGUIEnvironment();
That should do it.

Oh and btw: You have two pointers for the scene manager. You only need one. So you can remove one of the two pointers.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Personally, I'll be supporting the Code::Blocks builds, but not Dev-C++.

Just to clarify about tutorials, the best tutorials to use are the examples that come with your Irrlicht SDK (in the /examples directory). These are far more likely (I won't say guaranteed) to work without needing any modifications than some tutorial on the intartubes that might have been written years ago.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Sard
Posts: 8
Joined: Tue Dec 09, 2008 1:19 pm

Post by Sard »

Ok, I got it to work as intended :) Wasn't quite that easy as Sylence said, but I changed the while loop on the bottom to something different (got it from a tutorial) and it worked nicely :)

For some reason I didn't know Dev-C++ isn't in dev anymore, need to figure out some new compiler to work with. Think I'll poke code::blocks a bit.

And yus, I'll be looking the examples folder a bit more now, thanks for the help!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Sard wrote:For some reason I didn't know Dev-C++ isn't in dev anymore, need to figure out some new compiler to work with. Think I'll poke code::blocks a bit.
The lack of release dates makes it hard to tell. ;)

Please be aware that C::B on Windows uses the same compiler as Dev-C++ (mingw). It's not a problem, but it's worthwhile being specific about the difference between an IDE and a compiler.

For Windows development, I still tend to recommend Microsoft Visual C++ Express, but Code::Blocks is a remarkably competent and usable IDE, and mingw is a fine compiler.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply