如何使用Visual Studio 2012为Windows XP编译? [英] How do I compile for Windows XP with Visual Studio 2012?

查看:135
本文介绍了如何使用Visual Studio 2012为Windows XP编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我将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,将 Linker高级选项中的目标计算机设置为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.

Windows的 CTP ;可以安装针对VC ++ 2012的XP目标,但是您必须静态链接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和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.

  • Download link
  • Blog article containing additional information

这篇关于如何使用Visual Studio 2012为Windows XP编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆