Sign in to follow this  

TinyXML Help

This topic is 3664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm building my own mud and I'm at the point where I'm gonna implement saving user date to a file. I've used Andrew Russell's Mud Pies articles and they've been very helpful, but now TinyXML is giving me a big problem. The error code reads: datafile.cpp(36) : error C2668: 'TiXmlElement::Attribute' : ambiguous call to overloaded function \tinyxml\tinyxml.h(982): could be 'const char *TiXmlElement::Attribute(const char *,double *) const' \tinyxml\tinyxml.h(974): or 'const char *TiXmlElement::Attribute(const char *,int *) const' while trying to match the argument list '(const char [5], int)' What is causing this? The argument used for the 2nd arg is NULL when it is generating this error. Please Help!

Share this post


Link to post
Share on other sites
Ok i got an answer, but its ugly. Can anyone offer a better answer than this? Or explain why this doesn't work?

I put "int* q = NULL;" before the line calling the function, and used q in place of NULL, and it compiled fine. Why?

Share this post


Link to post
Share on other sites
Works for me. Perhaps it is something else you are doing, how about providing some source code.

[edit] Oh... are you trying to cast like (double)NULL? Because that would explain the error, it should be (double*)NULL. Alternatively, if you just want the attributes name, don't pass the second argument at all.

Share this post


Link to post
Share on other sites
Quote:
Original post by WackyWormer
Thanks jjd, this worked:

Attribute("name", (int*)NULL)

so why didn't this work?

Attribute("name", NULL)

doesn't NULL == NULL, no matter what pointer its stored in?


When the compiler sees Attribute("name", NULL), it cannot tell if it should be using Attribute( const char*, int* ) or Attribute( const char*, double* ).

Share this post


Link to post
Share on other sites

This topic is 3664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this