Qt5.5+VS2013编译的程序在xp下兼容问题解决方法

Deploying Qt on XP and getting “not a valid Win32 application”

By now Windows XP is getting a bit long in the tooth and Microsoft has dropped support for it. Windows 2003, though, is still supported by Microsoft. If you’ve using Qt together with Visual Studio (and not the MinGW compiler) and you try deploying your app to a Windows XP or Windows Server 2003 computer, chances are you’re seeing this error:

is not a valid Win32 application

Too far from the future?

This error will not occur for Qt with Visual Studio 2010, but it will when using Visual Studio 2012, 2013 or Visual Studio 2015.

Update thanks to comment below: (use QMAKE_LFLAGS_WINDOWS instead of tweaking the project’s setting):There are basically two ways to fix this; the easy way is to add one extra line to your project’s .pro file, or you can be more adventurous and binary-patch your app’s .exe file.
And yes, this has to be applied for every app you develop, until XP is gone gone gone…

Note: This same error (“.. not a valid Win32 application.”) occurs if you try to start a 64-bit app on a 32-bit Windows XP or Windows 2003 system, so make sure your app is really 32-bit flavored. One way to verify the bitness: launch your app in Windows 7 or 10, start Task Manager, in the process tab check that your app’s name has a “* 32” suffix.

Also: This tweaking do not affect or disturb deployment to other, later Windows versions like Windows 7. (In case you’re targeting multiple Windows versions.) I have verified this works on Windows XP Service Pack 3 and Windows Server 2003 Service Pack 1 and 2 systems.

Let’s take them in order:

  • Open the .pro file for your project and insert this line (I usually do it at the end):

    QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
    

    Why 5.01? Well if you look at the original settings, using for example dumpbin/headers on your .exe file, you see that the SUBSYSTEM:WINDOWS version is set to 6. This means it can run on Windows Vista and later and why Windows XP rejects it. By changing it to 5, we declare XP and Win2k3 as kosher chaps too. (Those numbers 5 and 6 are the internal Windows version numbers.)
    I thought originally it should be enough to specify /SUBSYSTEM:WINDOWS,5 but then the linker complains: LNK4010: invalid subsystem version number, and it resets it back to 6 :-( So 5.01 it is.

    Note: if you’re compiling a 64-bits flavored .exe file (and thus targeting 64-bits Windows XP) you instead should set <VALUE> to /SUBSYSTEM:WINDOWS,5.02

  • I promised you a more thrilling choice as well, it requires you to have a binary/hex file editor. Open your app’s .exe file with it, go to almost the beginning of the file, you’ll see something along the following lines:

    Before binary editing

    Before the binary editing

    Look for the hex sequence 06 00 00 00 00 00 00 00 (repeated one time). In my example above it’s on address 0000130 but it can be slightly different like 0000128 or 0000140.

    After binary editing

    After the binary editing

    There’s two consecutive series, change both of them to 05 00 01 00 00 00 00 00.

    This binary editing is equivalent to the linker setting I mention above, but actually it suffices to change the two 06 numbers to 05. However, the linker complained when I tried SUBSYSTEM:WINDOWS,5, so let’s humor Microsoft here and set the binary numbers equivalent to SUBSYSTEM:WINDOWS,5.01

    Note: if this a 64-bit .exe file, you’re supposed to instead change to 05 00 02 00 00 00 00 00 (two times).

    Save the .exe file, Windows XP and Win2k3 server should run the file fine.


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: vtk8.0.0编译好的库是一个用于可视化和图像处理的开源软件库。这个库是基于C++语言开发的,可以在各种操作系统和各种编译器上使用。在这种情况下,我们假设您是在Windows操作系统上使用Qt 5.9、Visual Studio 2015和PCL 1.8.1来编译和使用vtk8.0.0库。 首先,您需要确保您安装了Qt 5.9,这是一个跨平台的应用程序和UI开发框架。您可以从Qt的官方网站上下载并安装最新版本的Qt 5.9。 接下来,您需要安装Visual Studio 2015,这是一个强大的集成开发环境(IDE),用于编写和调试C++代码。您可以从微软官方网站上下载并安装Visual Studio 2015。 然后,您需要安装PCL 1.8.1,这是一个用于点云处理的开源库。您可以从PCL的官方网站上下载并安装最新版本的PCL 1.8.1。 最后,您需要将vtk8.0.0库与Qt 5.9、Visual Studio 2015和PCL 1.8.1集成在一起。首先,在Visual Studio 2015的项目设置中添加vtk8.0.0的头文件路径和库文件路径。然后,在您的项目代码中包含vtk的头文件,并链接vtk的库文件。 在编译和构建您的项目时,您需要确保选择正确的编译配置,以便使用Qt 5.9、Visual Studio 2015和PCL 1.8.1进行构建。 以上是使用vtk8.0.0库的一般步骤。根据您的具体项目需求,您可能需要进一步的配置和调整。希望这些信息对您有所帮助! ### 回答2: vtk8.0.0编译好的库适用于Qt5.9,VS2015,PCL1.8.1和VTK8.0版本。 首先,vtk8.0.0编译好的库是指已经经过编译,并可用于开发的库文件。该库文件中包含了VTK(Visualization Toolkit,可视化工具包)的功能和特性,可以用于构建和展示3D图像、可视化数据等。 Qt5.9是一个跨平台应用程序开发框架,可以用于创建图形界面和进行应用程序开发。vtk8.0.0编译好的库与Qt5.9兼容,因此可以在Qt应用程序中使用该库实现丰富的3D可视化功能。 VS2015是一个开发环境,适用于Windows操作系统。vtk8.0.0编译好的库是基于VS2015编译的,所以可以在该环境下使用该库进行开发。 PCL1.8.1是点云库(Point Cloud Library)的一个版本。vtk8.0.0编译好的库与PCL1.8.1兼容,可以使用该库来处理和可视化点云数据。 综上所述,vtk8.0.0编译好的库适用于Qt5.9,VS2015,PCL1.8.1和VTK8.0版本,可以在这些环境中使用vtk编译好的库开发和展示3D可视化功能。 ### 回答3: vtk8.0.0 编译好的库是基于以下工具和版本编译的:qt5.9、vs2015、pcl1.8.1以及vtk8.0。 vtk8.0.0是Visualization Toolkit的一个版本,它是一个开源的跨平台的3D图像处理和可视化库。它提供了丰富的功能和工具,用于处理和分析3D数据,并通过高质量的图形输出显示结果。 编译库使用的Qt版本为5.9。Qt是一个跨平台的应用程序开发框架,它提供了一套易于使用的工具和类库,用于开发图形用户界面应用程序。Qt 5.9的使用可以为vtk8.0.0库提供更强的功能和更好的用户体验。 在编译过程中,使用了VS2015作为集成开发环境(IDE)。VS2015是由微软开发的一个功能强大的集成开发环境,用于开发Windows平台上的应用程序。它提供了丰富的开发工具和调试功能,可以方便地进行代码编写和调试。 此外,编译还使用了pcl1.8.1。PCL(Point Cloud Library)是一个开源的用于点云处理的库,它提供了一系列的算法和工具,用于处理和分析点云数据。PCL 1.8.1提供了vtk8.0.0库所需的点云处理功能和支持。 综上所述,vtk8.0.0编译好的库是基于qt5.9、vs2015、pcl1.8.1和vtk8.0的。使用这些工具和库,可以轻松地进行3D图像处理和可视化开发,并获得高质量的结果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值