Solved

Ambiguous overload for 'wxString& = TiXmlElement*&' operator

Posted on 2004-08-23
6
397 Views
Last Modified: 2008-02-01
I am using the wxWidgets library (formally wxWindows) and the TinyXML library.  I want to parse a value from the XML document which will serve as my User Interface structure and update the button values for the elements of the sibling nodes

The variables for the button labels are lbutton1, lbutton2, lbutton3, lbutton4, etc.

I have used the following code to parse the XML document (hopefully) correctly:

node = doc.FirstChild( "UID" );
assert( node );
uidElement = node->ToElement();
assert( uidElement );
button1 = node->ToElement();
assert ( button1 );

When I add the following line

lbutton1 = button1;


, the code will not compile and I receive the following errors:

ambiguous overload for 'wxString& = TiXmlElement*&; operator
candidates are: wxString&
             wxString&
             wxString&
             wxString&
[Build Error] [UI.o] Error 1

I am using Bloodshed Dev-C++.  It seems to be some sort of circular reference I've created...I think...
0
Comment
Question by:vivekpara
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 11872470
How are 'lbutton1' and 'button1' declared?
0
 
LVL 86

Expert Comment

by:jkr
ID: 11872504
BTW, did you mean to

lbutton1 = button1->Attribute("AttributeName");
0
 
LVL 2

Author Comment

by:vivekpara
ID: 11872578
lbutton1 is declared by:

wxString ( lbutton1 );

button1 is declared
TiXmlElement* button1 = 0;

Don't know if thats what I meant...but it seems to make sense.  I'll try it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 50 total points
ID: 11872620
Reading the documentation, I guess could be:
lbutton1 = button1->Value();
0
 
LVL 86

Accepted Solution

by:
jkr earned 450 total points
ID: 11872630
The point is that you cannot just assign a 'TiXmlElement*' pointer to a 'wxstring' (see http://www.grinninglizard.com/tinyxmldocs/classTiXmlElement.html for the docs). If you want to strore an attribute in the wxstring, use

lbutton1 = button1->Attribute("AttributeName");
0
 
LVL 2

Author Comment

by:vivekpara
ID: 11872776
I will have to claim stupidity as my defense.  =)

I was cutting and pasting code and didn't notice that was a pointer.  Good call, y'all.

"You're right, you're right, I know you're right."
                            - Carrie Fisher
                            - "When Harry Met Sally"
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question