Using Visual C++ (MFC) Libraries in Newer Versions of Measurement Studio and Visual Studio

Updated Apr 18, 2023

Reported In

Software

  • Measurement Studio (Legacy)

Issue Details

I have an older program that uses Visual C++ MFC libraries and I would like to be able to compile it in Visual Studio 2013 or later. When I tried to compile the program, the Visual Studio compiler detected many LNK2038 mismatch errors. How do I fix this? 

Solution

You are experiencing this error due to mismatches between the Visual Studio compile chain used to compile your version of MFC and the current Visual Studio compiler.

Visual C++ MFC 11 is the last version released with Measurment Studio and can be found here . It is compiled with the Visual Studio 2012 Platform Toolset, so your project has to be compiled with a matching toolset.

Note: You have to have the Microsoft Visual Studio 2012 SDK Installed to be able to reference the toolset.

To change the project toolset:
  1. From Solution Explorer in Visual Studio, right click on your application (not your solution) to bring up the shortcut menu, then select Properties to open the Property Pages dialog box.
  2. In the Property Pages dialog box, click on the Configuration drop-down list and select All Configurations.
  3. In the left pane, expand Configuration Properties, then select General.
  4. In the right pane, select Platform Toolset, then select the toolset you want from the drop-down list. If you have MFC 11 installed, select Visual Studio 2012.
  5. Click on the OK button.
The screenshot below shows an example of the properties page for Visual Studio 2013: