I would like to transfer an old C++ MFC project from Visual Studio 2005 to a newer version. The project uses a multibyte character set that I know is no longer supported in the current Visual Studio. The first step should therefore be to make the project independent of the character set. A colleague at work told me that I can do this if I put a macro _T()
around each text.
Unfortunately, the project contains a lot of static text and adding the macros should take weeks.
Is there no other way?
There is no other way unfortunately. You can try to automate text editing with regex or some text editor like sed
.
But personally I would prefer to check all the code manually that no multibyte char-related code is left: use _tcslen
instead of strlen
, _TCHAR
instead of char
, etc.
Other variant to consider is to make code explicitly use widechars: wcslen
instead of strlen
, wchar_t
instead of char
, L"some string"
instead of _T("some string")
, etc.
UPD: also I found some good news "The deprecation warning [MFC support for MBCS deprecated] has been removed from MFC in VC2017 and we will continue to provide MBCS support in future releases." (https://blogs.msdn.microsoft.com/vcblog/2013/07/08/mfc-support-for-mbcs-deprecated-in-visual-studio-2013/), so probably you can just left it as it is.