Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

Ok, so I'm using Visual Studio 2012 in Windows 7 x64 for programming and compiling. My application works fine there, but when I try to execute it from a Windows XP SP3 Virtual Machine, I get "xxxx.exe is not a valid win32 application" right away.

The application is being compiled with static linking, that is, with /MT. I have set _WIN32_WINNT to 0x0501 in targetver.exe; the configuration manager is set to Win32 and the target machine in the Linker advanced options is set to MACHINEX86.

My targetver.h looks like this:

#include <winsdkver.h>  #define _WIN32_WINNT 0x0501 #define WINVER 0x0501 #define NTDDI_VERSION 0x0501  #include <SDKDDKVer.h> 

I also tried compiling with /MD and installing .NET Framework, but that didn't help either.

I'm clueless, and I could really use some help as I need to have it working for Windows XP.

like image 974
WiperWoper Avatar asked Oct 29 '12 22:10

WiperWoper


People also ask

Is Visual Studio compatible with Windows XP?

The toolset supplied in Visual Studio 2019 and later doesn't include support for creating code for Windows XP. Support for Windows XP development is available by using the Visual Studio 2017 v141_xp toolset. You can install the v141_xp toolset as an individual component option in the Visual Studio Installer.

Can Visual Studio 2019 run on Windows XP?

Visual Studio 2019 and later versions don't include current toolset support for creating code for Windows XP. Support for Windows XP development by using the v141_xp toolset that shipped in Visual Studio 2017 is still available as an optional component in the Visual Studio Installer.


2 Answers

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
like image 84
ildjarn Avatar answered Jan 01 '23 01:01

ildjarn


Two things should be done:

  • Configuration PropertiesGeneral page, change Platform Toolset to: Visual Studio 2012 - Windows XP (v110_xp);

  • Menu LinkerSystem. Change Subsystem to: Console/Windows.

A detailed explanation is here: http://software.intel.com/en-us/articles/linking-applications-using-visual-studio-2012-to-run-on-windows-xp

like image 31
Aliaksei Plashchanski Avatar answered Jan 01 '23 01:01

Aliaksei Plashchanski