本文介绍了如何在Windows 7 / visual studio 2008下编译Windows XP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Windows 7和Visual Studio 2008 Pro,并试图让我的应用程序在Windows XP SP3上工作。

I'm running Windows 7 and Visual Studio 2008 Pro and trying to get my application to work on Windows XP SP3.

这是一个真正最小的命令行程序应该有任何可笑的依赖:

It's a really minimal command line program so should have any ridiculous dependencies:

// XPBuild.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    printf("Hello world");
    getchar();
    return 0;
}

我在某处读到应该允许我为其他平台编译。我已经尝试添加以下到我的 / D 编译器选项:

I read somewhere that defining several constants such as WINVER should allow me to compile for other platforms. I've tried the added the following to my /D compiler options:

;WINVER=0x0501;_WIN32_WINNT 0x0501;NTDDI_VERSION=NTDDI_WINXP

但这没有什么区别。当我在我的Windows XP计算机上运行它(实际上运行在)时,我得到以下错误: / p>

But that made no difference. When I run it on my Windows XP machine (actually running in a virtualbox) I get the following error:

那么我错过了什么?是否还需要运行MSVC编译程序或不同的编译器选项或其他方法?

So what have I missed? Is there something else required to run MSVC compiled programs or a different compiler option or something else?

推荐答案

可能VC ++程序需要安装运行时(除非你静态链接,这不是默认) - 你显示的错误消息正是你得到的,如果他们不是有序。

What you have missed is most likely that VC++ programs require a runtime to be installed (unless you link statically, which is not the default) - the error message you show is exactly the one you get if they're not in order.

尝试安装在XP机器上 - 你很可能会看到你的程序没有任何变化。

Try installing the Microsoft Visual C++ 2008 SP1 Redistributable Pack on the XP machine - you will most likely see that your program works with no changes whatsoever.

这篇关于如何在Windows 7 / visual studio 2008下编译Windows XP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:22