Visual Studio 2012为XP编译 - 无效的win32 - v110_xp [英] Visual Studio 2012 compile for XP - not valid win32 - v110_xp

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

问题描述

我有Visual Studio 2012更新4和Windows SDK 7.1。

I have Visual Studio 2012 update 4 and the Windows SDK 7.1.

我选择了Visual Studio 2012 - Windows XP(v110_xp)工具包和include目录更改为使用$(WindowsSdkDir_71A)。

I select the "Visual Studio 2012 - Windows XP (v110_xp)" toolkit and the include directories change to use $(WindowsSdkDir_71A).

在编译期间没有提供错误(例如,它成功找到winres.h),但是当我尝试在Windows XP上运行exe SP3,它仍然错误:test.exe不是一个有效的Win32应用程序。

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."

对于测试,它只是一个C ++ hello世界。

For testing, it's just a C++ hello world.

#include <cstdio>

int main(void)
{
    printf("Hello, World!\r\n");
    return 0;
}

如何使用Visual Studio 2012编译XP?

How can I use Visual Studio 2012 to compile for XP?

我应该检查什么才能使这个工作?

What should I check to get this working?

如何在命令行上测试编译?
我目前正在测试命令行,这仍然给出无效的win32错误:

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" 

更新:
如果我对命令行使用这些说明, b http://blogs.msdn.com/b/ vcblog / archive / 2012/10/08 / 10357555.aspx

如果我把这些设置放到我的系统环境变量中,我也可以得到msbuild和visual工作室编译成功,但这不是理想的。

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.

推荐答案

需要更改的设置是
项目属性 - >配置属性 - >链接器 - >系统 - > SubSystem

The setting that needed to be changed was Project Properties -> Configuration Properties -> Linker -> System -> SubSystem

这需要设置为适当的项目类型的CONSOLE或WINDOWS,一个空项目,即使控制台vs GUI设置在其他地方,它似乎工作(例如WinMain是入口点,控制台不出现等)。最低必需版本也需要是5.01,但根据link.exe的命令行帮助,我不认为这样做除非子系统设置。

This needs to be set to CONSOLE or WINDOWS for the appropriate project type, but is not set by default for an "empty project", even if console vs GUI is set elsewhere and it appears to work (e.g. WinMain is the entry point, console does not appear, etc). Minimum Required Version also needs to be 5.01, but judging by the command line help on link.exe, I don't think this does anything unless subsystem is set.

检查:


  • Visual Studio 2012是更新1或更高版本

  • 安装了SDK 7.1, A存在

  • 使用了Visual Studio 2012 - Windows XP(v110_xp)工具包

  • 预处理器定义包含_USING_V110_SDK71 _

  • VC ++目录包含$(WindowsSdkDir_71A)bin,$(WindowsSdkDir_71A)include和$(WindowsSdkDir_71A)lib

  • 链接器子系统是控制台或窗口, / li>
  • Visual Studio 2012 is Update 1 or higher
  • SDK 7.1 is installed and 7.1A exists
  • the "Visual Studio 2012 - Windows XP (v110_xp)" toolkit is used
  • the preprocessor definitions contains _USING_V110_SDK71_
  • the VC++ Directories contain $(WindowsSdkDir_71A)bin, $(WindowsSdkDir_71A)include and $(WindowsSdkDir_71A)lib
  • linker subsystem is console or windows, with minimum required version 5.01

这篇关于Visual Studio 2012为XP编译 - 无效的win32 - v110_xp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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