What is wrong with the stupid VC 2005?
-
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
-
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
Your VS2005 defaults to unicode. "%d" is of type char but CString.Format needs a unicode format string. you can modify your code as following : cs24.format(L"%d",i_Random); or cs24.format(TEXT("%d"),i_Random); however please pay attention that this may not be the only place in your code you have to check against unicode (wchar_t) compatibility. cheers. Mohammad
-
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
-
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
To complete the previous answers: here[^] is a complete article about the subject. I suggest you take a look at it, you will learn a lot of usefull things.
Cédric Moonen Software developer
Charting control [v1.4] -
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
Well,
VC2005
is not stupid, hence... :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
Why do you use the term stupid when you risk to be the one who is stupid ? And there are many people here like me who will not accept such langage and the least they can do, they will let you with you problem without helping you. OK now, use the following macro without the need to change the charSet property of your project : _T ==> cs24.Format(_T("%d"),i_Random); always take the habit of using it, even when you have a nonUnicode charSet.
-
I have to move from VC6 to VC2005. here is some error code: //--------------------------- i_Random is int i_Random%=10; CString cs24; cs24.Format("%d",i_Random); //--------------------------- VC 2005 compiler says that last line above has error: error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *' with [ BaseType=wchar_t, StringTraits=StrTraitMFC_DLL<wchar_t> Do you know what the stupid VC2005 want to do?
includeh10 wrote:
What is wrong with the stupid VC 2005?
before saying so, you'd better: 1) searched the forum; it's been said tons of times already that VC6 defaults to ANSI when VS2005 defaults to UNICODE builds. 2) asked "what's wrong with the stupid VC6 ?". because, yes, VC6 is far less standard compliant that VS2005, hence it accepts mistakes without complaining, when VS2005 now will tell you YOU made an error. 3) understood you development environment before incriminiate a tools which only does what you tell it to do.
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]