G
Guest
I have a older C++ project from a pre .net Visual studio. I just want it to
run "the old way" in the new environment, not yet wanting to do any dotnet
stuff. Several conversions that worked before are errors now
The code
CString strAsciiLocation = (GetColumn() + 'a' - 1);
strAsciiLocation += (GetRow() + '0');
generates the error
c:\Documents and Settings\Charles\My Documents\Visual Studio Projects\Chess
Secratary\LocationOnBoard.cpp(207): error C2593: 'operator +=' is ambiguous
For the second line GetColumn and GetRow both return integers for example if
both returned 1 I wanted the string a1 for strAsciiLocation.
And
return CString('a' + FromLocation.GetColumn() -1)
+ CString('1' + FromLocation.GetRow() -1)
+ CString('a' + ToLocation.GetColumn() -1)
+ CString('1' + ToLocation.GetRow() -1);
generates four errors of the type
c:\Documents and Settings\Charles\My Documents\Visual Studio Projects\Chess
Secratary\Board.cpp(440): error C2440: 'type cast' : cannot convert from
'int' to 'ATL::CStringT<BaseType,StringTraits>'
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
Although the first line of the first example doesn't generate an error.
Any suggestions on how to make these kinds of conversions in the new
environment?
run "the old way" in the new environment, not yet wanting to do any dotnet
stuff. Several conversions that worked before are errors now
The code
CString strAsciiLocation = (GetColumn() + 'a' - 1);
strAsciiLocation += (GetRow() + '0');
generates the error
c:\Documents and Settings\Charles\My Documents\Visual Studio Projects\Chess
Secratary\LocationOnBoard.cpp(207): error C2593: 'operator +=' is ambiguous
For the second line GetColumn and GetRow both return integers for example if
both returned 1 I wanted the string a1 for strAsciiLocation.
And
return CString('a' + FromLocation.GetColumn() -1)
+ CString('1' + FromLocation.GetRow() -1)
+ CString('a' + ToLocation.GetColumn() -1)
+ CString('1' + ToLocation.GetRow() -1);
generates four errors of the type
c:\Documents and Settings\Charles\My Documents\Visual Studio Projects\Chess
Secratary\Board.cpp(440): error C2440: 'type cast' : cannot convert from
'int' to 'ATL::CStringT<BaseType,StringTraits>'
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
Although the first line of the first example doesn't generate an error.
Any suggestions on how to make these kinds of conversions in the new
environment?