the famous createIrrXMLReader()-problem

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

the famous createIrrXMLReader()-problem

Post by Frodenius »

the quest:
read the information for the creation of the irrlicht device from a xml-file.

you should think its easy...
before writing the proper code you hack a test app to become familiar with irrXML

Code: Select all

#include "irrlicht.h"
using namespace irr;
using namespace io;


#include <cstdio>
#include <cstdlib>
#include <string>

int main(){
        
    IrrXMLReader* xml = createIrrXMLReader("info.xml");
    if(!xml){
        printf("XMLReader couldnt be initialised!\n");
        system("PAUSE");
        return 1;
    }
    
    std::string nn;
    EXML_NODE exn;
    
    while(xml->read()){
        exn = xml->getNodeType();
        
        switch(xml->getNodeType()){
            case EXN_TEXT:
                printf("%s\n", xml->getNodeData());
                break;
            case EXN_COMMENT:
                printf("a comment\n");
                break;
            case EXN_ELEMENT:
            case EXN_ELEMENT_END:
                printf("element %s\n", xml->getNodeName());
                break;
            default:
                printf("unknown element\n");
        }
        
    }       
    delete xml;
    system("PAUSE");
    return 0;
}
now comes the hook:
your linker says he found an undefined reference to the function irr::io::createIrrXMLReader()
now you dig up the doc, but... you cant find the solution, only a simple:
If you are using the Irrlicht Engine, it is better not to use this function but IFileSystem::createXMLReaderUTF8() instead.
why?? the code of irrXML should be included in the irrlicht lib, shouldnt it?
because even niko doesnt know why the f* linker cant find the f* reference??
...
after searching the forum in vain, because nobody ever solved this prob, you quit your efforts and use the irrXML library...
... the app is blown up by 160 kB .... ok i could get over that but still.. its enormously queer this thing...
worst programming style ever seen...
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

Post by Frodenius »

ok i forgot to pose the question:
does anybody know the reason for this problem??
worst programming style ever seen...
Nick_Japan
Posts: 98
Joined: Mon Dec 13, 2004 11:47 am
Location: Japan

Post by Nick_Japan »

Does it actually say though that IrrXML is included SEPERATELY in the Irrlicht distribution, or just that it is included in the engine in the sense that you can use through the IGUIFileSystem?
Image Image
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

u have to create a device before u can use the xmlreader!
so just create a null device and than the xml reader.than u can recreate the real device with ur own settings
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

Post by Frodenius »

the thought was that there is the same code in irrlicht like in irrXML.
then why cant you just create a xmlreader without the device??
worst programming style ever seen...
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

because it's irrlicht not irrXML!!!!!
just read the doc and don'T discuss such useless stuff like why is it not like that....
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

Post by Frodenius »

but the simple IrrXMLReader shouldnt need the device!!
thats just stupid.
worst programming style ever seen...
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I'm sure Niko knows exactly why it doesn't find the reference. I'm sure he also considers this to be expected behavior. It only takes about 30 seconds to find the symbol that you are whining about is not exported from the dll. I'd suspect that it is done intentionally to keep people from bypassing the IFileSystem, which is exactly what you are wanting to do.

If you are really motivated to get around the issue, it takes about 3 minutes to fix the problem, rebuild the dll, and copy it to the appropriate directory. Either that, or you can just quit using the irrlicht dll and compile irrlicht directly into your app.

The comments in the relevant code indicate you should use the file system for the requested interface. If you do as advised, you get the interface you wanted.

Travis
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

Post by Frodenius »

yeh of course...
i was stuck with this issue some time ago and i searched the forum to solve the problem. i just wonderd why nobody could give a satisfiying answer to the question why ít wont work. its NOT satisfying that niko wants the irrlicht users to use the fileSystem...
worst programming style ever seen...
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

It's expected that you would have a device created. Everything else in irrlicht needs a device created, by design. If you only want XML, why are you using irrlicht? There has to be some other reason, and whatever reason it is, it needs a device created. If there is no reason you need a device and you only want XML, don't use irrlicht. Use an XML library, since that's all you want out of the library anyway.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

If your looking for a really high quality and lite 3rd party XML library, check out tinyXML
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

Post by Frodenius »

@zenaku
the quest:
read the information for the creation of the irrlicht device from a xml-file.
worst programming style ever seen...
Post Reply