Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2007

Tip: Looking for answers? Try searching our database.

Migrating from VC++ 6.0 to VC++ 2005

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arjun - 24 May 2007 20:37 GMT
Hi,

After migrating my application from VC++ 6.0 to VC++ 2005, I receive the
error C2593 'operator +=' is ambiguous.

It refers to the following line:

Name += pManager->GetAgentName();

where Name is a string and GetAgentName also returns a string.

Please suggest.

Regards,
Arjun
Nathan Mates - 24 May 2007 21:25 GMT
>After migrating my application from VC++ 6.0 to VC++ 2005, I receive the
>error C2593 'operator +=' is ambiguous.

>Name += pManager->GetAgentName();
>where Name is a string and GetAgentName also returns a string.

  The concept of 'string' in C++ is a very vague and overloaded
concept. Do you mean a char*, a std::string, a CString (ATL/MFC), a
tstring? [Or any other number of custom C++ string classes which may
exist in your code.] Or the unicode versions of any/all of those?

  My recommendation: find out what the types *really* are in the line
you posted above. That'll usually help point you in the right
direction, as I bet you'll find that they're different.

Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/ 
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Arjun - 24 May 2007 22:01 GMT
HI Nathan,

Its a CString.

CString MachineName;

Regards,
Arjun

> >After migrating my application from VC++ 6.0 to VC++ 2005, I receive the
> >error C2593 'operator +=' is ambiguous.
[quoted text clipped - 17 lines]
> # NOT speaking for Pandemic Studios. "Care not what the neighbors
> # think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Nathan Mates - 24 May 2007 22:28 GMT
>> >After migrating my application from VC++ 6.0 to VC++ 2005, I receive the
>> >error C2593 'operator +=' is ambiguous.

>> >Name += pManager->GetAgentName();
>> >where Name is a string and GetAgentName also returns a string.

>>    The concept of 'string' in C++ is a very vague and overloaded
>> concept. Do you mean a char*, a std::string, a CString (ATL/MFC), a
>> tstring? [Or any other number of custom C++ string classes which may
>> exist in your code.] Or the unicode versions of any/all of those?

>>    My recommendation: find out what the types *really* are in the
>> line you posted above. That'll usually help point you in the right
>> direction, as I bet you'll find that they're different.

>Its a CString.
>CString MachineName;

  First, don't top-post. English is read left-to-right,
top-to-bottom.  Trim off your replies to be just what you're
responding to.

  Next, why bring up 'MachineName' when is not found in the code
snippet you gave above -- it's 'Name' and whatever GetAgentName()
returns.  Also, note that I said to investigate the type*S* in that
line. Not 'type'. Plural. In your line about 'Name +=
blah->GetAgentName()', you need to look into the type*S* of the left
and right sides of that.

Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/ 
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Ben Voigt - 24 May 2007 22:39 GMT
>>> >After migrating my application from VC++ 6.0 to VC++ 2005, I receive
>>> >the
[quoted text clipped - 25 lines]
> blah->GetAgentName()', you need to look into the type*S* of the left
> and right sides of that.

Of course, this is SO fundamental to solving a "ambiguous function" error
that the compiler really should have told you that, along with the possible
matches it found.  In fact, I think VC++ 2005 does exactly that.

Please cut+paste the following few lines from the compiler output, where it
gives the argument types along with the candidate functions.

> Nathan Mates
> --
[quoted text clipped - 3 lines]
> # think. What are the facts, and to how many decimal places?" -R.A.
> Heinlein

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.