2014-12-09 93 views
0

我有一个可执行文件,由Windows 7 SP1 32位MSVS2013编译,C运行时静态链接和平台工具集“Visual Studio 2013 - Windows XP (v120_xp)“可执行文件有效的Win7和WinXP专业版SP3“不是有效的Win32应用程序(193)”

它在Win7上完美运行(请参阅Dependency Walker性能分析附件截图)。

enter image description here

它无法在WinXP运行:

enter image description here

这里是剖面测井:

Starting profile on 12/9/2014 at 2:55:03 AM 

Operating System: Microsoft Windows XP Professional (32-bit), version 5.01.2600 Service Pack 3 
Program Executable: c:\temp\OCTOPUS.EXE 
Program Arguments: 
Starting Directory: C:\Temp\ 
Search Path: C:\Program Files\ActiveState Komodo Edit 8\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\MATLAB\R2009b\runtime\win32;C:\Program Files\MATLAB\R2009b\bin;C:\VisaPoint\sbperl\perl\bin 

Options Selected: 
    Simulate ShellExecute by inserting any App Paths directories into the PATH environment variable. 
    Log DllMain calls for process attach and process detach messages. 
    Log DllMain calls for all other messages, including thread attach and thread detach. 
    Hook the process to gather more detailed dependency information. 
    Log LoadLibrary function calls. 
    Log GetProcAddress function calls. 
    Log thread information. 
    Use simple thread numbers instead of actual thread IDs. 
    Log first chance exceptions. 
    Log debug output messages. 
    Use full paths when logging file names. 
    Log a time stamp with each line of log. 
    Automatically open and profile child processes. 
-------------------------------------------------------------------------------- 

00:00:00.000: Failure starting the process. %1 is not a valid Win32 application (193). 


    [1]: http://i.stack.imgur.com/m82n6.png 
    [2]: http://i.stack.imgur.com/6Yr37.png 
+0

机器中发生故障的CPU是什么? VS2013的默认设置会生成不能在某些AMD处理器上运行的可执行文件。 – 2014-12-09 11:45:20

+0

[Visual Studio 2013中的Windows XP和Windows Server 2003支持]的可能重复(http://stackoverflow.com/questions/19724029/windows-xp-and-windows-server-2003-support-in-visual-studio- 2013) – sashoalm 2014-12-09 12:58:46

回答

-1

好了,只是忘了把子系统连接器选项。 这里是解释链接: https://software.intel.com/en-us/articles/linking-applications-using-visual-studio-2012-to-run-on-windows-xp

+0

如果不设置SUBSYSTEM,则无法链接二进制文件。您没有*忘记*设置SUBSYSTEM;你用了一个不合适的。这在[Hans Passant的答案](http://stackoverflow.com/a/27379460/1889329)中有解释。 – IInspectable 2014-12-09 14:23:43

+0

我忘记将SUBSYSTEM设置为5.01以启用WINXp兼容性。如果在VisualStudio 2013中未设置SUBSYSTEM,平台工具集设置不起作用。实际上,如果平台工具集设置为C++,升级4之后的VS2013开始发出关于链接器中未设置SYSTEM设置的警告。 – rlib 2014-12-09 14:45:16

1

现代版本的Visual Studio,用VS2012起,使用该标志与当前一代的Windows兼容的可执行映像连接设置。版本6,从Vista开始。 XP和Server2003是上一代版本5.

您仍然可以使用VS2013构建在XP上运行的程序。但是你必须改变设置。用鼠标右键单击项目,属性,常规。将平台工具集设置更改为v120_xp

有一些后果,您的程序使用旧版本的Windows SDK构建。 V7.1,最后一个仍然与XP兼容。 C运行时库产生一系列操作系统调用,这些调用仅在第6代中可用。它会在没有它们的情况下蹒跚而行,影响与线程和文化相关的相对较小的细节。这是应该提醒你的FUD,它仍然是承诺支持这样一个古老的操作系统可能不是最好的主意。确保你保持一个正在运行的XP版本,以便你可以正确地测试和重新制作。请记住,你不能再安装VS,所以如果你确实得到了XP用户的支持电话,那么你往往会得到相当严重的偏头痛。

相关问题