使用Visual Studio 2012编译的C程序在XP上失败,错误.exe不是有效的Win32应用程序 [英] C Program compiled using Visual Studio 2012 fails on XP with error .exe is not a valid Win32 application

查看:133
本文介绍了使用Visual Studio 2012编译的C程序在XP上失败,错误.exe不是有效的Win32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C语言编写的遗留程序(不是C ++)。它使用Visual C ++ 6.0编译好并在Windows XP和Windows Server 2003计算机上运行。我最近将它移植到64位机器上,Windows 7和Visual Studio 2012
(更新2)。它适用于Win32和x64平台,并且在Windows 7机器上运行良好。但是当我尝试将可执行文件移动到XP机器并运行它时,我一直认为XXX.exe不是有效的Win32应用程序。

I have a legacy program that was written in straight C (not C++). It compiled fine using Visual C++ 6.0 and ran on a Windows XP and Windows Server 2003 machines. I recently ported it to a 64 bit machine with Windows 7 and Visual Studio 2012 (Update 2). It compiles fine there for both Win32 and x64 platforms and also runs fine on Windows 7 machines. But when I try to move the executable to an XP machine and run it I keep getting XXX.exe is not a valid Win32 application.

项目属性是:

常规:平台工具集:Visual Studio 2012 - Windows XP(v110_xp)

General:Platform Toolset: Visual Studio 2012 - Windows XP (v110_xp)

常规:配置类型:应用程序(.exe)

General:Configuration type: Application (.exe)

C / C ++:运行时库:多线程(/ MT)

C/C++:Runtime Library: Multi-threaded (/MT)

链接器:子系统:Windows(SUBSYSTEM:WINDOWS)

Linker:SubSystem: Windows (SUBSYSTEM:WINDOWS)

在阅读时forumns似乎表明编译XP系统应该可行,但我肯定没有太多运气。任何建议都将不胜感激。

In reading the forumns it seems to indicate compiling for an XP system should work, but I'm sure not having much luck. Any suggestions would be greatly appreciated.

推荐答案

b

Hi,

不是你的应用程序导致问题,它是由VS2012生成的setup.exe。我们找到解决它的唯一方法是使用VS2010发布。

It is not your application causing the problem, it is the setup.exe produced by VS2012. The only way we have found to get around it is to publish using VS2010.

请尝试以下命令行。我不确定它是否可行。

Please try the below command line .I am not sure whether it will work or not .

命令行更改为:win32 {QMAKE_LFLAGS + = /SUBSYSTEM:CONSOLE,5.01 QMAKE_CXX + = / D_USING_V110_SDK71_ LIBS * = -L"%ProgramFiles(x86)%/ Microsoft SDKs / Windows / 7.1A / LIB" INCLUDEPATH + ="%ProgramFiles(x86)%/ Microsoft SDKs / Windows / 7.1A / Include"
}

如果您认为有帮助,请点击"投票为有用"! 。如果回答了帖子的问题,请点击"标记为答案"。

if you think is helpful, click "Vote As Helpful"! .If it is answered to the question of the thread, click "Mark As Answer".


这篇关于使用Visual Studio 2012编译的C程序在XP上失败,错误.exe不是有效的Win32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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