无法在 Windows XP 中使用 QT5 和 VS2013 创建应用程序 运行

Cant Run Application Created With QT5 And VS2013 In Windows XP

我使用 QT5Visual Studio 2013 创建了应用程序。我也在我的应用程序中使用 QT WebEngine

我的应用程序在 windows 7(32 位)中运行良好。出于某种原因,我需要在 windows xp sp3(32 位)中 运行 它。

当我 运行 它时,我得到以下错误:

The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll

我按了几次 OK,它消失了,我的 QMainWindow 会弹出,但它完全是黑色的,我在调试器中看到以下错误。

class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available

d3dcompiler_47.dll也在应用程序目录中。

这里有什么问题吗?

更新 1

我将 3dcompiler_46.dll 放在可执行文件的目录中,结果就是这样。

我仍然收到 The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll 错误,但在我按下 Ok 后,我也收到以下错误。

The procedure entry point _except_handler4_common could not be located in the dynamic link library msvcrt.dll

QMainWindow 仍然是 BLACK 并且关于 ANGLE 的错误是相同的。

更新 2

我使用以下配置为 Windows XP 构建 QT

configure -release -opensource -opengl desktop -target xp -platform win32-msvc2013 -angle -icu -nomake examples -prefix C:\QT-Compile

我替换了 QT 依赖项和 运行 我的应用程序,我收到以下错误:

The application has failed to start because icuin56.dll was not found
The application has failed to start because icuuc56.dll was not found

我试图在 QT 目录 (C:\QT-Compile) 中找到它们,但我找不到,但我在 Windows Seven 中的 运行 主机上找到了它们,我成功地将它们放在可执行文件和应用程序 运行 旁边,并且以前的错误消失了,但是, QMainWindow 仍然是 BLACK 并且我在 运行 中的调试器中出现以下错误时间。

QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
bool __thiscall QOpenGLTextureBlitter::create(void) Could not link shader program:

现在有什么问题吗?

更新 3

我就是这样配置的 QT

configure -release -opensource -opengl dynamic -target xp -platform win32-msvc2013 -icu -nomake examples -prefix C:\QT-Compile

我使用 windeployqt.exe 并将所需的 DLL 和...放在可执行文件旁边。

运行 windows xp 中的应用程序,我不断收到以下错误然后应用程序崩溃。

消息框:

The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll

QT 调试器:

class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001

class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available
Failed to load opengl32sw.dll (The specified module could not be found.)
class QOpenGLStaticContext *__cdecl QOpenGLStaticContext::create(bool): Failed to load and resolve WGL/OpenGL functions

关于 msvcrt.dll 的第一个错误是关于不在您的二进制文件中包含 visual studio 运行time dll。似乎在 Win XP 机器上,这些库与您的应用 link反对

的库不同

接下来的两个错误是关于无法启动 ANGLE 的,可能是由于您之前遇到的 MS VS 运行次不匹配。

基本上,只需将 msvcr110.dll 和 msvcp110.dll 放入您的文件夹(或提供安装 MS VS Redistributable for 2013 Studio 的方法)

这是来自 digia 的详细部署文档 - http://doc.qt.io/qt-5/windows-deployment.html

另外,我建议您使用 qt 的工具 windeployqt.exe 作为部署过程的一部分。 用法很简单——windeployqt.exe path/to/your/binary/file.exe

它会复制几乎所有你的应用程序需要的东西到运行你的应用程序无处不在,而不会打扰你包含一些插件和 dll 等(尽管它不会复制上面提到的 MSVS 运行time dlls)

此外,如果您对 post 对动态加载图形驱动程序的 qt5 使用不同的 opengl 感兴趣(尝试使用默认 opengl -> 失败尝试使用 ANGLE -> 如果失败,尝试使用opengl 软件 (libmesa) ) - http://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers

它比 Qt4 复杂一点,但当你最终正确处理它时,即使在没有图形驱动程序或没有直接 X 支持或通过 VPN 启动的机器上,它也会更加安全

更新

您的桌面 opengl 和 ANGLE 似乎都失败了(这意味着您的 OpenGL 实现版本低于 3.0(win xp 上的默认版本为 2.0)桌面 opengl 失败并且您没有 DirectX安装了 11 或 DirectX 9 正确的驱动程序(ANGLE 失败)。

这意味着这是虚拟机或 window 没有任何驱动程序。要解决此问题,请将 opengl32sw.dll (libmesa) 也包含到您的可执行文件中。这是在桌面和 ANGLE 都失败的情况下的另一种回退。

您可以从您的QtCreator 安装文件夹/tools 中获取。或者在这里下载 - http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/ 取决于你的足弓。

此外,尝试将 win xp 中的 d3dcompiler_46.dll 放在可执行文件旁边。这可能会修复 运行 时间错误并允许启动 ANGLE - https://bugreports.qt.io/plugins/servlet/mobile#issue/QTBUG-44985

更新 2:

让我们逐行获取它。 您收到 The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll 警告是因为您使用的不是 SP3 而是 SP2 的 Win XP(微软放弃了对 MSVS 2013 的 Win XP SP2 的支持)- 更多详细信息 here where there is the same issue. Or there is the same bug here 基本上建议使用 opengl 软件.

现在,您在日志中看到的错误:

  1. class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001 - 这是 OpenGL 桌面的失败,因为您没有 Open GL 2.0 -> 适当的图形驱动程序。

  2. class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available - ANGLE 失败。因为 - qt 使用 mvcrt.dll 用于不再支持您的 Win XP SP2 的 MSVS 2013,或者您没有 d3dcompiler。也许它可以与使用 MSVS 2008 或 MSVS 2012 构建的 Qt 5.4 一起使用。

Failed to load opengl32sw.dll (The specified module could not be found.) class QOpenGLStaticContext *__cdecl QOpenGLStaticContext::create(bool): Failed to load and resolve WGL/OpenGL functions - 这些错误与缺少 opengl32sw.dll 文件有关。我已经提供了 link 供您下载并生成可执行文件。

并且应用程序崩溃,因为 Qt 根本无法 运行 任何 OpenGl 模式。所以基本上你所能做的就是强制应用程序使用 OpenGL 软件(我多次为你提供 link 如何执行此操作,请阅读那些指南。)或使用 qt 5.4 并尝试 运行 角度。 OpenGL 软件可能 运行 不流畅,并且在复杂的图形界面方面存在一些问题,但这基本上是唯一剩下的了。

win 7遇到同样问题,安装显卡驱动解决

我找到了另一个解决方案作为从 opengl 切换到软件光栅器并删除这些消息的辅助选项:

Could not initialize EGL display: error 0x3001
When using ANGLE, check if d3dcompiler_4x.dll is available

因为在我的情况下,VirtualBox 环境目前在 OpenGL/DirectX (https://forums.virtualbox.org/viewtopic.php?t=82614&start=15#p408392) 实现方面存在问题,所以我尝试寻找解决方案并以某种方式解决渲染问题。

QT 本身有一个选项可以切换或禁用几个内置选项 w/o 需要重建任何东西。如此处所述: https://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers

It is possible to provide a JSON-format configuration file specifying which OpenGL implementation to use depending on the graphics card and driver version. The location is given by the environment variable QT_OPENGL_BUGLIST. Relative paths are resolved using QLibraryInfo::SettingsPath or QStandardPaths::ConfigLocation. The file utilizes the format of the driver bug list used in The Chromium Projects. It consists of a list of entries each of which specifies a set of conditions and a list of feature keywords. Typically, device id and vendor id are used to match a specific graphics card. They can be found in the output of the qtdiag or dxdiag tool.

qtdiag 工具基本上存储在 qmake 可执行文件附近。您还可以 运行 它来诊断终端系统的其他错误。

对于 VirtualBox 你可以试试这个:

{
  "entries": [
    {
      "id": 1,
      "description": "Software OpenGL rasterizer (opengl32sw.dll)",
      "os": {
        "type": "win"
      },
      "vendor_id": "0x80EE",
      "device_id": ["0xBEEF"],
      "driver_version": {
        "op": "<=",
        "value": "5.1.38.22592"
      },
      "features": [
        "disable_desktopgl", "disable_angle"
      ]
    }
  ]
}

,其中:

disable_desktopgl, disable_angle - When no accelerated path is desired. This ensures that the only option Qt tries is the sofware rasterizer (opengl32sw.dll). Can be useful in virtual machines and applications that are deployed on a wide range of old systems.

  • 5.1.38.22592 是 VirtualBox 的一个版本。

这可能不是您要搜索的内容,但我自己没有及时找到它。