Reputation: 1343
I am using Windows 7 (64-bit) to develop a Qt (5.3) application. The Visual Studio files are created by 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
.
I tried to create the binaries for Windows XP, too.
I added this line to the CMakeLists.txt for the 32-bit version
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,5.01")
and this line for the 64-bit version
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.
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)
.
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,
(EDIT: but works fine on Windows 7 64-bit).
What am I doing wrong? :(
Upvotes: 1
Views: 756
Reputation: 40512
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)
Upvotes: 2