[英]64-bit Qt application crashes on XP 64-bit (but not on Win7 64-bit)
I am using Windows 7 (64-bit) to develop a Qt (5.3) application. 我正在使用Windows 7(64位)开发Qt(5.3)应用程序。 The Visual Studio files are created by CMake.
Visual Studio文件由CMake创建。 This works fine for 32-bit and 64-bit binaries for Windows 7. CMake Generator for 32-bit is
Visual Studio 12 2013
, for 64-bit Visual Studio 12 2013 Win64
. 对于Windows 7的32位和64位二进制文件,此方法工作正常。32位的CMake Generator是
Visual Studio 12 2013
,对于64位的Visual Studio 12 2013 Win64
。
I tried to create the binaries for Windows XP, too. 我也尝试为Windows XP创建二进制文件。
I added this line to the CMakeLists.txt for the 32-bit version 我将此行添加到了32位版本的CMakeLists.txt中
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01")
and this line for the 64-bit version 这行是64位版本
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.02")
I am using windeployqt
for the deployment for of the QT dependencies. 我正在使用
windeployqt
部署QT依赖项。
After running CMake and starting the generated Visual Studio I chose the Release-Mode and changed the platform toolset to Visual Studio 2013 - Windows XP (v120_xp)
. 运行CMake并启动生成的Visual Studio之后,我选择了Release-Mode并将平台工具集更改为
Visual Studio 2013 - Windows XP (v120_xp)
。
The created 32-bit binary works fine on Windows XP 64-bit, the 64-bit binary crashes with "hello-world.exe has encountered a problem and needs to close. ..." on Windows XP-64-bit, 在Windows XP 64位系统上,创建的32位二进制程序可以正常工作,在Windows XP 64位系统上,64位二进制程序崩溃时显示“ hello-world.exe遇到问题,需要关闭...。”,
(EDIT: but works fine on Windows 7 64-bit). (编辑:但是在Windows 7 64位上工作正常)。
What am I doing wrong? 我究竟做错了什么? :(
:(
I had a similar problem and specifying subsystem to the linker didn't fix it. 我有一个类似的问题,指定链接器的子系统无法解决该问题。 However the following solution worked fine for me:
但是以下解决方案对我来说效果很好:
ADD_CUSTOM_COMMAND(
TARGET my_target
POST_BUILD
COMMAND editbin my_target.exe /SUBSYSTEM:WINDOWS,5.01 /OSVERSION:5.1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.