If open with vs2015 directly below the 2015 version of the multibyte character set project, can be compiled through, but if use vs2015 set multibyte character set was not in new projects,
You come across this problem? Or my problem here?
CodePudding user response:
Is the fault of the utf8 of?CodePudding user response:
Vs2015 multibyte character set doesn't work in the project, set up or in the use of Unicode, even without any other class, create a new project, set up a multi-byte character set, or the default Unicode compiled,Literally write two sentence code like this:
Cstrings STR="11";
SetWindowText (" 11 ");
An error would be prompted to
The error C2440: "initialization" : from "const char [3]" into "ATL: : CStringT
Note: a class of "ATL: : CStringT
The error C2664: "void CWnd: : SetWindowTextW (LPCTSTR)" : 1 cannot be parameters from "const char [3]" into "LPCTSTR"
CodePudding user response:
No one knows how to solve it, I also met this problemCodePudding user response:
Cstrings STR=_T (" 11 ");CodePudding user response:
To install MBCS patch, to find ms's official websiteCodePudding user response:
I this ok vs2015 update3And unicode this good why not?
CodePudding user response:
New standard c + + default char utf8 individual characters to feel quite goodDon't choose the best new project MBCS unicode when the conversion time is turn utf16 or utf8 turn 16? Easy to cause confusion
CodePudding user response:
Cstrings STR="11";SetWindowText (" 11 ");
Change
Cstrings STR=_T (" 11 ");
SetWindowText (_T (" 11 "));
CodePudding user response:
Cstrings and string have what distinctionCodePudding user response:
Want to install MBCS patch, "" to find" "ms websiteAs if such
CodePudding user response:
MFC SetWindowText is encapsulation of Windows API, there is only one kind of coding, there will be a problem, of course,And the operator overloading cstrings, generally there are two: in view of the different versions MBCS and Unicode,
In general, cstrings project set to what kind of coding, is right:
Cstrings str1="11".
Cstrings str2=L "11";
Cstrings str3=_T (" 11 ");//or TEXT (" 11 ")
The SetWindowText is different, the ANSI/MBCS must be:
SetWindowText (" 11 ");
Unicode must be:
SetWindowText (L "11");
Of course, you can use any cstrings to setup:
SetWindowText (LPCTSTR str1);
SetWindowText (LPCTSTR str2);
SetWindowText (LPCTSTR str3);
That is because cstrings operator overloading will transform any coding for the project set encoding, which accords with the SetWindowText,
CodePudding user response:
Check your project properties or is there any other places in the code set UNICODE or _UNICODE both macro,CodePudding user response:
I often meet with, not only modify the character set is invalid, modify other configuration items are invalid. Change the exe to DLL, for example, to modify the runtime library, for example, all invalid. There is no find a solution, I will only reinstall it appeared.CodePudding user response: