Solved

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

Posted on 2004-08-23
6
391 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

832 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