[solved] How to use my own TinyXML with QuickGUI


08-12-2010 13:03:20


after some time now i'm going to implement a GUI to my software. After having no special preferences and trying QuickGUI, MyGUI and CEGUI, QuickGUI was the only one which compiled without doing insane stunts and tons of dependencies. I like the slim design so I think I will stick with it. :)

There is only one Problem left: I'm using TinyXML in my project and so does QuickGUI. This results in a conflict as there are two compiled TinyXML version in my project right now (my own, and the one in the QuickGUI lib). Not being stupid I thought I could just exclude my own TinyXML from the build and hopefully my code fragments which use TinyXML will use the TinyXML from the QuickGUI lib.

Edit: I just tried to compile it again and I was wromg. There are no 'unresolved references', infact the code compiles just fine and runs to the point where I first use TinyXML to read some data from a XML file. :( Obviously the file is loaded (as no error is given) but the attribute i read is 0 (which it isnt) and then the program crashes. Edit2: Altthough it doesnt crash anymore, still the attributes are not read properly.

After giving this some thought I came to the conclusion that this could be a version conflict problem. The TinyXML I use is a little bit newer than the one in the QuickGUI lib. I will try to copy 'my' TinyXML to the QuickGUI path and recompile the library. Maybe this will help. :?

Being somewhat of a noob in C++ I was thinking, that it cannot be that I am the only one which uses TinyXML and QuickGUI, so my question is: How to do it in a proper way?

Or as a 'Back to Basics' Question: How to deal with this kind of problem in general?

Edit: Sorry forgot to add this. :D
QuickGUI 10.8
TinyXML 2.6.1
Ogre 1.7.1
Eclipse CDT 'Wascana build'


08-12-2010 17:08:06

Let me know if that fixes it. I'll update the TinyXML version either way, but it would be nice to know.

I hadn't even thought about this before, but as far as avoiding it in the future, do you have any suggestions? I guess we could always wrap the TinyXML code in "namespace QuickGUI {}", but that seems a little clunky... :?

Also, are you linking against QuickGUI or just dumping all the code into your own project? Because I just realized I link against two libraries that use TinyXML and I don't end up with that problem...


08-12-2010 21:34:52

I finally got it to work. :D

After trying to replace the TinyXML in the QuickGUI path and rebuild the lib (which did not work), I settled to just dump all QuickGUI code in a seperate directory in my project (just as I did before with TinyXML and MOC). I had to do some adjustements, like fixing the include Path for the tinyxml header and, strangely enough, call .c_str() on every string that was passed to a TinyXML method. I wonder if there has been some change in the TinyXML Interface? I also had to exclude the QuickGUITimer.cpp from the build.

Anyhow, I made it work for me. QuickGUI now uses 'my' TinyXML and as a minor drawback I have to rebuild it every time I do a 'clean' build, but I can live with that.

I'm pretty sure that this is not the proper way to do it, but I'll stick to my paradigma 'do what it takes' to get my software running. ;)
It concluded in a lot more files to link with and an update to a newer version will be a pain in the arse, but hopefully this release will carry me long enough, so I'll cross that bridge when I get there.

Nevertheless I already like QuickGUI, as it gave me the oportunity to solve this as I did.


08-12-2010 21:40:59

Haha, alrighty then! :D

The c_str() issue is probably because you haven't defined TIXML_USE_STL, which makes TinyXML use std::string instead of char*. I'm honestly not sure why they have that "feature" (or why the default isn't to use the STL), but oh well.