Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile MFC program with VS 2012 running on windows xp

I have the VS 2012 on windows 7. I want to build a MFC program which can be run on windows XP. However I received the following error while I moved the exe file to windows XP: “It is not a valid win32 application”.

After exploring on internet, I discovered that I should install Visual Studio 2012 Update 1 and change the Platform toolset from “Visual Studio 2012 (v110)” to “Visual Studio 2012 - Windows XP (v110_xp)”. I also changed the target machine to “MachineX86 (/MACHINE:X86)”. This time I receive another error while I run the exe file on windows XP: “the procedure entry point initializecriticalsection could not be located in the dynamic library KERNEL32.dll”.

Now I do not know what to do :(. I do appreciate if some can help me :).

Please note that I tried a simple dialog MFC program without adding any code to it.

like image 887
shervin Avatar asked Apr 20 '13 09:04

shervin


People also ask

How do you compile in MFC?

To compile an MFC extension DLL by using /clr As an alternative, in Solution Explorer, right-click Stdafx. cpp and then click Properties. Under Configuration Properties, expand the node next to C/C++ and select General. Set Compile with Common Language Runtime support to No Common Language Runtime support.

Is MFC still supported?

Although it has long been succeeded by the . NET environment as the most widely-used Windows development framework, MFC is by no means 'dead'. It is likely to be found in some older legacy code bases, and it's still being developed and supported by Microsoft.

Is MFC obsolete?

No, it's not "deprecated". At least not by anyone with the official status to deprecate it.


1 Answers

This is a bug in Visual Studio 2012 Update 2. The link has a workaround for Update 2 (although a community sourced one), and Microsoft has this to say:

Posted by Microsoft on 06/05/2013 at 16:16

Yes, this is fixed in Update 3

So your best bet is to roll back to Update 1 or wait for Update 3.

EDIT Visual Studio 2012 Update 3 Release Candidate has been released with "go-live" licensing. Caveat:

Statement of Support:

Visual Studio 2012 Update 3 RC and Team Foundation Server 2012 with Update 3 RC are “go-live”. This means that customers can use these builds in production environments. These are still pre-releases, so there may be some bugs that will be fixed for the final release. Upgrade from Update 3 RC to Update 3 RTM is supported. In order to upgrade to future releases, the customer must first upgrade from Update 3 RC to Update 3 RTM.

More information is available here.

EDIT 2 Turns out rolling back to Update 1 breaks Visual Studio...

like image 188
ta.speot.is Avatar answered Sep 20 '22 11:09

ta.speot.is