Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] TinyXML problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
azmodai
n00b
n00b


Joined: 07 Jul 2006
Posts: 63

PostPosted: Tue Mar 02, 2010 1:49 pm    Post subject: [SOLVED] TinyXML problem Reply with quote

Hello,

I've got troubles with a masked package : tinyxml.
I just want to know if the problem is due to me or to the package that is not yet stable enaugh.

I wrote a very short program to test tinyxml, actually I only test the first function we've got to call in order to load the XML file we want to parse.

The code part :

Code:

#include <tinyxml.h>

int main(void) {

   TiXmlDocument Doc("test.xml");

   //if(!Doc.LoadFile()) return EXIT_FAILURE;

   //TiXmlHandle HandleDoc(&Doc);
   //TiXmlElement Elements();
   //TiXmlHandle HandleRoot();

   return EXIT_SUCCESS;
}


I build the binary like this :
g++ -ltinyxml -o test ./test.cpp

it fails and I got a very strange message that doesn't change whatever the code line I comment :
here the error output :

Code:

/tmp/ccmvpsca.o: In function `TiXmlString::quit()':
test.cpp:(.text._ZN11TiXmlString4quitEv[TiXmlString::quit()]+0x15): undefined reference to `TiXmlString::nullrep_'
collect2: ld returned 1 exit status


Is this due to me or is this due to the masked package ?

thanks,


Last edited by azmodai on Tue Mar 02, 2010 2:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Tue Mar 02, 2010 2:15 pm    Post subject: Reply with quote

Add

#define TIXML_USE_STL

before you #include the tinyxml.h

and

g++ -o test ./test.cpp -ltinyxml
Back to top
View user's profile Send private message
azmodai
n00b
n00b


Joined: 07 Jul 2006
Posts: 63

PostPosted: Tue Mar 02, 2010 2:18 pm    Post subject: Reply with quote

Thank you very much, it works.
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Tue Mar 02, 2010 2:20 pm    Post subject: Reply with quote

See /usr/portage/dev-libs/tinyxml/files/Makefile

There is a line

CPPFLAGS += -DTIXML_USE_STL

This will make TinyXML use & need the #define line

If you modify the Makefile, remove the -DTIXML_USE_STL, redigest the ebuild, and recompile it.. the #define won't be needed anymore

There's 2 ways of using the library, but AFAIK the way it's now in Portage is the more new way, ... maybe it could be optional, but do we really need it?
Back to top
View user's profile Send private message
azmodai
n00b
n00b


Joined: 07 Jul 2006
Posts: 63

PostPosted: Wed Mar 03, 2010 2:13 pm    Post subject: Reply with quote

Thanks for the information, but I'm going to add it anyway. Because The code I'm making must work on Windows too ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum