21

I opened my existing MFC project using Visual Studio and when I build I get the following error message:

Error 1 error MSB8031: Use of MBCS encoding in MFC projects require an additional library to be downloaded and installed. Please see http://go.microsoft.com/fwlink/?LinkId=286820 for more information. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\v120\Microsoft.CppBuild.targets

What is this about?

Raman Sharma
  • 4,551
  • 4
  • 34
  • 63

3 Answers3

43

This error message is due to the missing MBCS MFC package. Starting with Visual Studio 2013, MBCS portion of the MFC library has been broken out of the Visual Studio product into its own separate download. Installing this package and rebuilding should fix the problem.

  • The download is available here
  • More information about this change is available here

Update for Visual Studio 2015

Starting with Visual Studio 2015, the entire MFC C++ library (including the MBCS pieces) is an optional install component. While installing VS2015, if you select C++ and MFC, you will also get the MBCS library.

Raman Sharma
  • 4,551
  • 4
  • 34
  • 63
  • 1
    When I install MFC MBCS package you linked above I got following error message "This product applies only to the MFC library, which is not present on this computer". I use VS 2013 Premium Update 3. – tommyk Sep 18 '14 at 09:43
  • Do you have VS2013 installed on your machine? – Raman Sharma Sep 23 '14 at 07:03
  • 3
    In a meantime I solved the problem. The reason was that I didn't install MFC core libraries during Visual Studio installation so MBCS MFC package couldn't be installed because it needs MFC core libraries. – tommyk Sep 23 '14 at 07:08
  • also migrating old MFC projects have been made easier with Visual Studio 2017 - consider upgrading – serup Jun 15 '17 at 23:31
8

Instead of installing an add-on, you may consider changing the character set from MBCS to Unicode.

This is done in the project properties as is depicted below. project properties

ragnarius
  • 5,642
  • 10
  • 47
  • 68
  • 4
    That comes with a cost though. You might need to make code changes. But yes, long-term that is the right direction. – Raman Sharma May 21 '15 at 15:48
0

For Visual Studio 2015:

According to Redistributing the MFC Library article on MSDN, there are no mfc140.dll files in redist directory (c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86).

The mfc140.dll files were omitted from the redistributable files directory in Visual Studio 2015 RTM. You can use the versions installed by Visual Studio 2015 in the Windows\system32 and Windows\syswow64 directories instead.

tibx
  • 840
  • 13
  • 20