Home > Software engineering >  VS2015 multibyte character set is invalid?????? Is this a BUG? You have met?
VS2015 multibyte character set is invalid?????? Is this a BUG? You have met?

Time:09-19

Use VS2015, establish a new MFC project, the project set up to use multi-byte character set, join a multi-byte character set, no matter how to compile all is pass, if it is UNICODE is no problem,
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 constructor of the statement of "explicit"
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 problem

CodePudding user response:

Cstrings STR=_T (" 11 ");

CodePudding user response:

To install MBCS patch, to find ms's official website

CodePudding user response:

I this ok vs2015 update3
And unicode this good why not?

CodePudding user response:

New standard c + + default char utf8 individual characters to feel quite good
Don'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 distinction

CodePudding user response:

Want to install MBCS patch, "" to find" "ms website
As 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:

reference 13 floor waj19831 reply:
I often encountered, 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.

Is said to be a multi-byte character set patch,

CodePudding user response:

You need to download a patch to multibyte seem don't support multibyte by default

CodePudding user response:

My VS2015 Update1 is normal, also didn't MBCS patch,

CodePudding user response:

Cstrings STR=_T (" 11 ");
CStringA STR="11";
CStringW STR=L "11";

One to one correspondence

CodePudding user response:

  • Related