问题描述
好的,所以我在 Windows 7 x64 中使用 Visual Studio 2012 进行编程和编译.我的应用程序在那里运行良好,但是当我尝试从 Windows XP SP3 虚拟机执行它时,我立即收到xxxx.exe 不是有效的 win32 应用程序".
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.
正在使用静态链接编译应用程序,即使用 /MT
.我已经在 targetver.exe 中将 _WIN32_WINNT 设置为 0x0501;配置管理器设置为Win32,链接器高级选项中的目标机器设置为MACHINEX86.
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.
我的 targetver.h 看起来像这样:
My targetver.h looks like this:
#include <winsdkver.h>
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
#define NTDDI_VERSION 0x0501
#include <SDKDDKVer.h>
我也尝试过使用 /MD
进行编译并安装 .NET Framework,但这也无济于事.
I also tried compiling with /MD
and installing .NET Framework, but that didn't help either.
我一无所知,我真的可以使用一些帮助,因为我需要让它在 Windows XP 上运行.
I'm clueless, and I could really use some help as I need to have it working for Windows XP.
推荐答案
VC++ 2012 RTM 不支持 Windows XP – 该支持于 2012 年晚些时候在 Visual Studio 2012 Update 1 中提供.
VC++ 2012 RTM did not support Windows XP – that support came later in 2012 in Visual Studio 2012 Update 1.
可以安装 面向 VC++ 2012 的 Windows XP 的 CTP,但您必须链接CRT 静态以便部署.请参阅 这篇博客文章 了解更多信息.
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 添加了对在 Windows XP 上运行使用 VC++ 2012 构建的应用程序的官方支持以及动态链接 CRT 的能力.
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.
- 下载链接
- 包含附加信息的博客文章
这篇关于如何使用 Visual Studio 2012 为 Windows XP 进行编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!