新建的一个vs2013控制台应用程序,在使用v120_xp工具集编译后,在windows xp上运行时,仍然提示“不是有效的win32应用程序”。
解决:
1、右键项目->属性->链接器->系统->子系统->选择“控制台 (/SUBSYSTEM:CONSOLE)”
2、右键项目->属性->链接器->系统->所需的最低版本->5.01
原文引用:(https://devblogs.microsoft.com/cppblog/windows-xp-targeting-with-c-in-visual-studio-2012/)
" Specify the correct subsystem and subsystem version for the linker based on the type of application you are building. Applications targeting the x86 version of Windows XP must specify subsystem version 5.01, and applications targeting x64 must specify version 5.02.
For x86 console applications:
set LINK=/SUBSYSTEM:CONSOLE,5.01 %LINK%
For x64 console applications:
set LINK=/SUBSYSTEM:CONSOLE,5.02 %LINK%
"
本文解决了一个在Visual Studio 2013中创建的控制台应用程序,使用v120_xp工具集编译后,在Windows XP上运行时提示“不是有效的Win32应用程序”的问题。通过调整链接器设置,指定正确的子系统和子系统版本,确保了应用程序在目标操作系统上的兼容性。
5万+

被折叠的 条评论
为什么被折叠?



