l33t
l33t

Reputation: 19937

Compile MFC program in VC11 with support for Windows XP?

My software is written in C++/MFC. I target Windows XP and later. Hence, I cannot upgrade to Visual Studio 11 since MFC 11.0 does not support Windows XP. Still, I would like to benefit from the improved optimizer in VC11. (Currently, I don't need the new C++11 stuff.)

I can think of two solutions, but maybe there are others too:

  1. Replacing the compiler in VC10 with the one from VC11.
  2. Upgrading to VC11 and use old MFC 10 from VC10.

Which approach would you recommend?

Edit: Visual Studio 2012 seems to have C++ support for XP. Does this apply MFC too?

Upvotes: 2

Views: 3103

Answers (4)

dyasta
dyasta

Reputation: 2191

While you can change Platform Toolsets to VC10 or before, this is not exactly ideal.

Pending an OOB update from Microsoft (see below), you can NOT target XP/2003 with VC11. You can only switch platform toolsets. The CRT uses NT6+ specific APIs.

Indeed, I want the optimizations of VC11 as well. However, I must maintain support for XP/2003.

Microsoft announced, actually prior to the RTM of VS2012, that support for XP/2003 would be re-enabled for VC11 in some pending out of band update 'later this fall' (of 2012). Here we wait ...

The CTP of 'Update 1' has now been released, supporting XP as a build target for VC11 (as a specifically set CRT differentiated from VC11). It is available for download here: http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx .. Released 2 days ago (Oct 8 2012).

Upvotes: 1

Lex Li
Lex Li

Reputation: 63143

Since native multi-targeting has been supported in Visual Studio 2010, you should check if Visual Studio 11 supports it too,

http://blogs.msdn.com/b/vcblog/archive/2009/12/08/c-native-multi-targeting.aspx

Edited: If you have Visual Studio 2010 and Visual Studio 2008 installed on the same box, you should be able to

  • go to Project Property Pages,
  • navigate to General tab under Configuration Properties,
  • choose either Visual Studio 2010 (v100), or Visual Studio 2008 (v90) for Platform Toolset option.

In this way, you can compile your project in Visual Studio 11, but using older Visual Studio (2010 or 2008) toolset. The resulting executable with older MFC libraries should work fine on Windows XP.

Upvotes: 1

Ted.
Ted.

Reputation: 133

Does your app link statically or dynamically to the CRT and MFC? If statically, you can give this workaround a try:

http://tedwvc.wordpress.com/2012/03/11/how-to-get-visual-c-2012-vc-11-beta-statically-linked-crt-and-mfc-applications-to-run-on-windows-xp/

Upvotes: 0

Jabberwocky
Jabberwocky

Reputation: 50778

You could just stick with Visual Studio 2010 for your software.

AFAIK you can install Visual Studio 2010 and 2011 on the same machine without them interfering.

Upvotes: 0

Related Questions