I have a very basic program in C++ compiled in VS 11 Beta on windows 7.
All project settings are default except Runtime Library. I changed Multi-threaded DLL (/MD) to Multi-threaded (/MT). This staticly links the runtime library as far as I know.
Trying to run this exe on another windows 7 machine with VS 11 Beta installed works fine.
Trying to run it on a windowx XP machine with no VS installed causes an error popup saying.
"**.exe is not a valid Win32 application"
Is there some settings that need to be changed to make a binary work on XP that was compiled with VS 11 Beta on Win7?
VS 11 no longer supports Windows XP. This is by design from Microsoft.
http://connect.microsoft.com/VisualStudio/feedback/details/690617
This behavior is by design in MFC and CRT for Visual Studio 11 Beta. The minimum supported operating systems are Windows Server 2008 SP2 and Windows Vista. Windows XP is not a supported operating system for the Beta release (design-time or run-time).
Reading further into the discussion, there's a possibility that Windows XP may be supported in the release version. I wouldn't bank on it though.
Edit: Microsoft have relented: Targeting Windows XP with C++ in Visual Studio 2012
Probably you compiled for 64 bit Windows. Windows XP, however, only supports 32 bit code.
来源:https://stackoverflow.com/questions/10095716/c-binary-doesnt-work-on-windows-xp