I have Visual Studio 2012 update 4 and the Windows SDK 7.1.
I select the "Visual Studio 2012 - Windows XP (v110_xp)" toolkit and the include directories change to use $(WindowsSdkDir_71A).
No errors are given during compile (e.g. it successfully finds winres.h), but when I try to run the exe on Windows XP SP3, it still errors: "test.exe is not a valid Win32 application."
For testing, it's just a C++ hello world.
#include <cstdio>
int main(void)
{
printf("Hello, World!\r\n");
return 0;
}
How can I use Visual Studio 2012 to compile for XP?
What should I check to get this working?
How can I test compile on the command line? I'm currently testing on the command line with this, which still gives the invalid win32 error:
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cl.exe" /EHsc /MT /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" /I"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include" main.cpp /link /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib"
Update: It works if I use these instructions for the command line: http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx
If I put these settings into my system environment variables, I can also get msbuild and visual studio to compile successfully, but this is not ideal.