How to Compile for Windows Xp with Visual Studio 2012

How do I compile for Windows XP with Visual Studio 2012?

VC++ 2012 RTM did not support Windows XP – that support came later in 2012 in Visual Studio 2012 Update 1.

The CTP of Windows XP targeting with VC++ 2012 could be installed, but you would have to link the CRT statically in order to deploy. See this blog article for more information.

Visual Studio 2012 Update 1 added official support for running applications built with VC++ 2012 on Windows XP as well as the ability to link the CRT dynamically.

  • Download link
  • Blog article containing additional information

Visual Studio 2012 compile for XP - not valid win32 - v110_xp

The setting that needed to be changed was
Project Properties -> Configuration Properties -> Linker -> System -> SubSystem

This needs to be set to CONSOLE or WINDOWS for the appropriate project type, but is not set by default for an "empty project", even if console vs GUI is set elsewhere and it appears to work (e.g. WinMain is the entry point, console does not appear, etc). Minimum Required Version also needs to be 5.01, but judging by the command line help on link.exe, I don't think this does anything unless subsystem is set.

Things to check:

  • Visual Studio 2012 is Update 1 or higher
  • SDK 7.1 is installed and 7.1A exists
  • the "Visual Studio 2012 - Windows XP (v110_xp)" toolkit is used
  • the preprocessor definitions contains _USING_V110_SDK71_
  • the VC++ Directories contain $(WindowsSdkDir_71A)bin, $(WindowsSdkDir_71A)include and $(WindowsSdkDir_71A)lib
  • linker subsystem is console or windows, with minimum required version 5.01

How can I generate a Visual Studio 2012 project targeting Windows XP with CMake?

According to http://www.cmake.org/Bug/view.php?id=10722 the answer is no yes.

Update: The bug mentioned above has been resolved with the following comment:

Fixed in Version CMake 2.8.11

A new "generator toolset" feature has been added here:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dab9977 [^]

One may now run CMake from the command line with

-G "Visual Studio 10" -T "v90"

in order to build with a specific toolset. We've not yet added a
first-class interface to cmake-gui for this, but one may add the cache
entry "CMAKE_GENERATOR_TOOLSET" to contain the "-T" value before
configuring.

You might also look at the comments made to the other answers.



Related Topics



Leave a reply



Submit