Discussion:
How to compile old projects with non-unicode char set?
(too old to reply)
JiiPee
2015-09-29 19:09:53 UTC
Permalink
Many old projects are done using ASCII char set. So when compiling with
VS 2015 it does not accept code like:

CString s;
s.Format("Hey there %i old", 35);
pDC->TextOut(10, 30, s);

Is it possible to change settings so that this would compile without
changing the code? (A lot of old big projects are done like this and its
not reasonable to ask them to convert everything to UNICODE)

I tried MBCS , but it does not work.
Woody
2015-09-30 09:16:31 UTC
Permalink
You need to do two things: Set the project to "Use MBCS" in the general options, and have the MBCS MFC library available (you have to download it, at least as of VS2013). You will get messages during compilation to the effect of "MBCS is deprecated", which you can ignore (and there is a preprocessor variable you can define that will turn off the messages.

MS made a decision to switch to Unicode as the standard in VS2013--there is a blog post by the VC++ group giving the details.

After you have done these, the code should compile and run using the ASCII character set.
JiiPee
2015-09-30 18:59:07 UTC
Permalink
Post by Woody
You need to do two things: Set the project to "Use MBCS" in the general options, and have the MBCS MFC library available (you have to download it, at least as of VS2013). You will get messages during compilation to the effect of "MBCS is deprecated", which you can ignore (and there is a preprocessor variable you can define that will turn off the messages.
MS made a decision to switch to Unicode as the standard in VS2013--there is a blog post by the VC++ group giving the details.
After you have done these, the code should compile and run using the ASCII character set.
This does not seem to work though (with VS2015) as I have already done
what they say in:
https://msdn.microsoft.com/en-us/library/dn251007.aspx
"In Visual Studio 2015, the MFC library for multibyte character encoding
(MBCS) is included in the Visual C++ setup components. Visual C++ and
MFC are optional install configurations in Visual Studio setup. To make
sure that MFC is installed, choose *Custom* in setup, and under
*Programming Languages*, make sure that *Visual C++* and *Microsoft
Foundation Classes for C++* are selected."

Seems like they claim it is included in the installation but it does not
work. But I will try more googling about this MBCS library if its there.

The thing is that I do have that MBCS option there but it does not
compile the old MFC non-unicode code.

I googled "MBCS MFC library visual studio 2015 download" and got that
link above.
JiiPee
2015-09-30 19:18:22 UTC
Permalink
Post by JiiPee
This does not seem to work though (with VS2015) as I have already done
https://msdn.microsoft.com/en-us/library/dn251007.aspx
Also, Microsoft worker says "@Vertex : In VS 2015 RTM, the MBCS MFC
libraries have been moved back into VS
setup under the "MFC" optional feature. "

But when I install ("modify" -installation) there is no option like
"MFC". there is MFC, but there is nothing under that - no MBCS . Do I
need to first unisntall my current VS and re-install? I tried via
"modify" current installation....
Woody
2015-10-01 05:12:21 UTC
Permalink
I am using VS2013, and the steps I outlines do work; I had to use them for every project for which I was using ASCII (most of them).

I cannot advise you on VS2015, as I do not have it.
JiiPee
2015-10-01 08:56:22 UTC
Permalink
Post by Woody
I am using VS2013, and the steps I outlines do work; I had to use them for every project for which I was using ASCII (most of them).
I cannot advise you on VS2015, as I do not have it.
yes, its odd ass there was this add on for VS2015 preview, but its not
there anymore. And the advice they gave does not seem to be true with
the release version.

Loading...