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++

  • Great! Enables us to move forward with C++11 despite having to support XP for some time.

    Though I will propably wait with bying VS11 until someone independently confirms that the post-RTM update actually does what we expect.

  • The next greatest thing would be a 64 bits linker that can do PGO for 32 bits targets.

    The memory requirement for the linker are exponential, particularly with PGO, so many, many big projects are hitting the 4Gb limit and have to give up on PGO.

  • That's great! But how exactly do you plan to achieve this? Are you going not to use modern Windows API in C Runtime?

    It would be great to see a blog post about technical challenges and decisions.

  • Really great news!  You actually listened; I am shocked!  I wish the Windows 8 team would listen this well.

    You seem to allude that Windows XP support is something that we would need to opt into.  You also mention that you were taking advantage of a number of APIs that were Vista+.

    This makes me wonder - if I target XP only, are there features of the compiler / language / runtime that will become unavailable?  What trade-offs am I making by targeting XP?  (Note I am wondering about this from a compiler perspective.  Obviously if my app is to run on XP, my source code can't directly use new Vista+ APIs, and I'd imagine there are some newer MFC features I couldn't use.  But I don't use MFC.)

  • Very good news for those of us who write applications that still need to support XP!  We can upgrade to VS compilers supporting more C++11 features once they are available for XP.

  • Great news! Thanks you for listening customer feedback: this was a very misguided decision in the first place.

    (only those who don't have to make decisions don't make mistakes!)

    This is a huge brick in the garden of bad mouth guys saying MS is not listening customers!

    Next time someone tells MS does not listen: raise this very item. Proof of Listening!

    I just can't wait to put my hands on this update and upgrade my projects to VS11! :-)

  • I want to build C++ AMP applications.  Will such an app even run on XP?  Will restrict(amp) mode fall back to CPU emulation if on XP?

  • @kellison : To my knowledge, AMP requires SSE2, but has no hard OS dependency. I.e., as long as someone has a non-ancient CPU, I don't think AMP will have an issue on XP.

  • This is great news. We will be migrating our projects to the new Visual Studio 2012 when support for Windows XP is ready. Thanks for listening.

  • @ildjarn

    I was under the impression that AMP requires DirectX 10 which is not available on XP.

  • @GigaPlex,ildjarn: I would be OK with no GPU acceleration on XP as long as it fell back to CPU mode with no noticeable degradation compared to compiling without AMP.  That way, it still works for XP users, but if they really want to get the performance, they need to upgrade to 7.

  • Nice one. If VS 2010 compiler can finally build these apps, it's simply what we want. Thanks Steve!

Page 5 of 5 (72 items) 12345