Targeting Windows XP with C++ in Visual Studio 2012

Targeting Windows XP with C++ in Visual Studio 2012

Rate This
  • Comments 72

We recently announced the Visual Studio 2012 product lineup and platform support, and as a part of this announcement we mentioned that we were evaluating options for enabling C++ developers to build applications in Visual Studio 2012 that run on Windows XP without requiring side-by-side installation of Visual Studio 2010. Today I would like to share more details about this capability.

Background
The C++ runtime and libraries that accompany Visual Studio 2012 contain dependencies on several Windows API functions that exist only on Windows Vista and higher versions of the OS.  This means that applications built with Visual Studio 2012’s C++ compiler will fail to load and execute on Windows XP. Developers wishing to target Windows XP can use Visual Studio’s C++ multi-targeting feature, which enables the use of the Visual Studio 2010 compiler from within the new IDE. Multi-targeting enables developers to take advantage of the new features of the IDE without migrating projects to the new compiler or to use the Visual Studio 2010 compiler to build applications that target Windows XP.

Assessing Multi-targeting
The Beta release of Visual Studio 2012 offered us an opportunity to evaluate the effectiveness of C++ multi-targeting, particularly among developers that wish to target Windows XP. Feedback from customers cited two key scenarios they wanted Visual Studio 2012 to support in order to best meet their needs for Windows XP targeting:

  1. The ability to target Windows XP and higher from a single compiler and tools chain rather than resort to separate builds for XP and for Vista+.
  2. The ability to target Windows XP and higher from a single code base that employs modern C++11 language features.

In order to better meet customer needs relative to build configuration and XP targeting, we have made the decision to enhance multi-targeting to support Windows XP targeting directly from the Visual Studio 2012 C++ compiler and libraries.

Enhancing Multi-targeting
Later this fall, Microsoft will provide an update to Visual Studio 2012 that will enable C++ applications to target Windows XP. This update will make the necessary modifications to the Visual C++ 2012 compiler, runtime, and libraries to enable developers to create applications and DLLs that run on Windows XP and higher versions as well as Windows Server 2003 and higher. This update will also be included in the recently-announced Visual Studio Express 2012 for Windows Desktop.

Steve Teixeira
Director of Program Management
Visual C++

  • Yes! Thank you!

    Now we wait for your out-of-band updates to the VC++2012 compiler...

  • Thank you for restoring some measure of confidence within the VC++ dev community.

    This is certainly the right decision, and I'm glad a course correction was made.

  • OMG. I never in my wildest dreams imagine that MS would back down and change their decision about this.

    They actually listen to feedback. I have a hard time believing that this happen.

    Im now exited about VS2012 again, and looking forward to using it.

  • Excellent. Thank you. The road ahead just got a lot clearer.

  • Great. Now I can write code for the morons still running a 10-year-old OS. Why not bring back Windows 3.1 support as well?

  • Oh my god. I don't want to sound harsh, but this is the first truly requested "feature" of VC2012! Not to mention the gradual inclusion of more C++11x features, which makes it the SECOND thing we will get!

  • "Now I can write code for the morons still running a 10-year-old OS. Why not bring back Windows 3.1 support as well?"

    Windows 3.1 wasn't still available for you to purchase as the OS on new computers 2 years ago.

  • Amazing. Looking forward to buying and using the new toolset. :-)

  • Responding to a few questions in the comments thread...

    @Paul: Including MFC?

    Yes, MFC, ATL, STL, PPL, CRT, etc., will support XP targeting.

    @GregM, @Jamome, others: Why "multi-targeting"? Will there be two tool chains in VS2012?

    I'm using this term because folks may need to explicitly opt into XP targeting in VS, although there are still a few moving parts in this area, so it will be some weeks before we close on the design. The key point is that developers will be able to target everything from XP to Win8 with one VC++ tool chain.

    @Dave Buches: What versions of XP/2k3 will be supported?

    The design is not closed on this issue, either. We are aiming for a similar level of platform support to VS2010 (described at msdn.microsoft.com/.../ws0swas0.aspx). We definitely will not support an earlier SP level than VS2010, although the possibility exists that we may require a more recent SP level.

  • Hi Steve, if you're considering limiting to XP SP3, then please consider supporting XP SP2 also because there is only one extra function that needs to be wrapped/worked around: the GetLogicalProcessorInformation Win32 API, which was added in XP SP3 but is not available in XP SP2.  

    Please also consider 2003 Server (and XP) x64 edition (for native 64 bit app support)

  • @Steve Teixeira: Great, thanks for the response!

  • Oh, do you know how long after VS2012 RTM the update will be released?

  • @JK, we don't have a more specific release date to share yet.

  • Win XP forever, you will never need to reinvent the X Wheel

  • Sanity is restored.  I may actually upgrade to VC 2012 now.

    Thank you for seeing the light.

Page 3 of 5 (72 items) 12345