如何编译为Win XP使用Visual Studio 2012? [英] How to compile for Win XP with Visual Studio 2012?

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

问题描述

好了,所以我使用的Visual Studio 2012在Windows 7 64位系统编程和编译。我的应用程序在那里工作很好,但是当我尝试从Windows XP SP3的虚拟机执行它,我得到XXXX.EXE不是有效的Win32应用程序的时候了。

该应用程序被编译静态链接,也就是与/ MT。我已经设置_WIN32_WINNT在targetver.exe 0x0501;配置管理器设置为Win32和链接器高级选项目标机器设置为MACHINEX86。

我targetver.h看起来是这样的:

 的#include< winsdkver.h>#定义_WIN32_WINNT 0x0501
的#define WINVER 0x0501
#定义NTDDI_VERSION 0x0501#包括LT&;&SDKDDKVer.h GT;

我也试过用/ MD编译和安装的.NET Framework,这没有帮助。

我无能,我真的可以使用一些帮助,我需要把它的Windows XP的工作。先谢谢了。


解决方案

<子>的评论转贴,请注意,这个答案只适用于VC ++的 2012

VC ++ 2012 RTM做的不可以支持WinXP的&ndash的;今年晚些时候的支持会在VS2012更新1。

<击>在此期间,可以安装的WinXP CTP与VC ++ 2012 的目标,但你'会有些静态,以部署链接到CRT。请参见本博客文章更多信息。< /罢工>


编辑:的Visual Studio 2012更新1已被释放,并增加了对运行用VC ++ 2012构建于Windows XP以及链接到动态的CRT的能力,应用程序的官方支持

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.

解决方案

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 to 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 to the CRT dynamically.

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

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