2014-12-09 101 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用戶的支持電話,那麼你往往會得到相當嚴重的偏頭痛。

相關問題