Solved

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

Posted on 2004-08-23
6
395 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
  • 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
Industry Leaders: 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

730 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