CString szMsg;
//Other non related code
//stOrderInfo.bstrOrderNum is defined as a _bstr_t
szMsg += ", Order: " + stOrderInfo.bstrOrderNum;
I’m converting the above from VS 6.0 to VS2k10 and I’m getting the following error (compiles in VS 6.0):
error C2593: 'operator +=' is ambiguous
What exactly does this mean and how can I fix it?
Because you’ve hard-coded “, Order: “ the compiler is having a hard time to decide which type it should be.
The obvious type should be
CString, but it might try to make it to some other string type, and add the number to it.So it probably can’t decide if it’s a
CStringor another string type. So it can’t decide what type you’re adding to szMsg.You could just use a type cast:
Cast between string types:
How to: Convert Between Various String Types