Ok, so I'm using Visual Studio 2012 in Windows 7 x64 for programming and compiling. My app 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 link, 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, 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. Thanks in advance.
Perhaps be late with the solution, or it may not be the expected solution, but when you generate the .exe, the version for 32-bit it will be in Project folder bin\x86\Release
Two things should be done:
Configuration Properties > General page, change Platform Toolset to: Visual Studio 2012 - Windows XP (v110_xp);
Linker > System. Change Subsystem to: Console/Windows.
Details explanation here: http://software.intel.com/en-us/articles/linking-applications-using-visual-studio-2012-to-run-on-windows-xp
Reposting from comment, and note that this answer is only applicable to VC++ 2012:
VC++ 2012 RTM does not support WinXP – that support will come later this year in VS2012 Update 1.
In the meantime, you can install the CTP of WinXP targeting with VC++ 2012, but you'll have to link the CRT statically in order to deploy. See this blog article for more information.EDIT: Visual Studio 2012 Update 1 has now been released, and adds official support for running apps built with VC++ 2012 on Windows XP as well as the ability to link the CRT dynamically.