本文介绍了无法在Windows XP中使用QT5和VS2013创建的运​​行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用QT5Visual Studio 2013创建的应用程序.我还在应用程序中使用了QT WebEngine.

I have application created with QT5 and Visual Studio 2013. I also use QT WebEngine in my application.

我的应用程序在Windows 7(32位)中运行正常.由于某些原因,我需要在Windows XP SP3(32位)中运行它.

My application works fine in windows 7 (32 bit) . For some reason i need to run it in windows xp sp3 (32 bit).

运行它时,出现以下错误:

When i run it, I get the following error:

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

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

I press OK several time and it goes away and my QMainWindow will pop out, But its totally BLACK and i see the following errors in debugger.

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也在应用程序目录中.

The d3dcompiler_47.dll is in application directory too.

这是怎么了?

更新1

我将3dcompiler_46.dll放置在可执行文件的目录中,这就是发生的情况.

I placed 3dcompiler_46.dll in executable's directory and this is what happened.

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

I still get The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll error but after i press Ok, I get the following error as well.

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

QMainWindow仍然是BLACK,关于ANGLE的错误是相同的.

The QMainWindow is still BLACK and the errors about ANGLE is the same.

更新2

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

I build QT for Windows XP with following configuration

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

我替换了QT依赖关系并运行了我的应用程序,出现以下错误:

I replaced QT dependency and ran my application, I got the following errors:

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,并且在运行时调试器中出现以下错误.

I tried to find them in QT directory (C:\QT-Compile) and i couldn't but i had them on main machine that run in Windows Seven, I placed them next to executable and application run successfully and previous errors are gone, However, The QMainWindow is still BLACK and i have the following errors in my debugger in run time.

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和...放置在可执行文件旁边.

I used windeployqt.exe and placed required DLLs and ... next to executable.

在Windows XP中运行了应用程序,并且我不断收到以下错误,然后应用程序崩溃了.

Ran application in windows xp and i keep getting following errors then application crash.

消息框:

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运行时dll.看来,在Win XP机器上,这些库与您的应用所链接的库不同.

The first error about msvcrt.dll is about not including visual studio runtime dlls with your binary file. It seems that on win XP machine these libs are different then the ones your app is linked against

接下来的两个错误是有关未能启动ANGLE的,这可能是由于您先前遇到的MS VS运行时不匹配造成的.

The next two errors are about failing to start up ANGLE probably due to mismatch of MS VS runtimes that you have encountered previously.

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

Basically, just put msvcr110.dll and msvcp110.dll in your folder (or provide means to install MS VS Redistributable for 2013 Studio)

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

Here is detailed deployment doc from digia - http://doc.qt.io/qt-5/windows-deployment.html

我也建议您在部署过程中使用qt的工具windeployqt.exe.用法很简单-windeployqt.exe path/to/your/binary/file.exe

Also i would advice you to use qt's tool windeployqt.exe as a part of deploy process.Usage is simple - windeployqt.exe path/to/your/binary/file.exe

它将复制您几乎所有在任何地方运行您的应用所需的应用程序,而不会打扰您包括一些插件和dll等(尽管它不会复制上述MSVS运行时dll)

It will copy almost everything you app needs to run your app everywhere without bothering you to include some plugins and dlls etc (though it will not copy mentioned above MSVS runtime dlls)

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

Also if you are interested a post about using different opengl for qt5 built dynamically loading of graphical drivers ( tries to use default opengl -> is fails tries to use ANGLE -> if fails, tries to use opengl software (libmesa) ) - http://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers

与Qt4相比,它要复杂一些,但是当您最终正确地处理它时,即使在没有图形驱动程序,没有直接X支持或通过VPN启动的机器上,它也将具有更高的故障保护能力

It's a bit more complicated then in Qt4, but when you finally handle it properly, it will be more fail safe even on machines with no graphical drivers or no direct X support or launched through VPN

更新

似乎桌面opengl和ANGLE都对您失败(这意味着您的OpenGL实现版本低于3.0(win xp的默认设置为2.0)),导致桌面opengl失败并且您没有DirectX 11或已安装DirectX 9正确的驱动程序(以使ANGLE失败).

It seems that both desktop opengl and ANGLE fails for you (which would mean, that you have OpenGL implementation version less then 3.0 (default on win xp has 2.0) for desktop opengl to fail and you don't have DirectX 11 or DirectX 9 correct drivers installed (for ANGLE to fail).

这意味着这是虚拟机或没有任何驱动程序的窗口.要解决此问题,请在可执行文件中同时包含opengl32sw.dll(libmesa).如果台式机和ANGLE都失败了,这是又一个后备方法.

This would mean that this is either virtual machine or window without any drivers. To fix this issue, please include opengl32sw.dll (libmesa) to you executable file as well. This is another fallback in case both desktop and ANGLE failed.

您可以从QtCreator安装在/tools文件夹中的文件夹中接收.或在此处下载- http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/取决于您的拱门.

You can take in from the folder where your QtCreator installed in folder /tools. Or download it here - http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/depending on your arch.

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

Also, try to put d3dcompiler_46.dll from your win xp next to your executable. This might fix runtime error and will allow to launch 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警告,是因为您拥有的Windows XP的操作系统不是SP3而是SP2(Microsoft放弃了对MSVS 2013的Win XP SP2的支持)-更多详细信息此处存在相同问题的地方.或者在此处中存在相同的错误,基本上可以建议使用opengl软件.

Let's get it line by line.You've got The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll warning because of either you have win XP with not SP3 but SP2 (microsoft dropped support for win XP SP2 for MSVS 2013) - more details here where there is the same issue. Or there is the same bug here that would basically advice to use opengl software.

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

Now, the errors you see in log:

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

  1. class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001 - this is failure of OpenGL desktop, since you don't have Open GL 2.0 -> proper graphical driver.

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

class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available - ANGLE is failed. Because either - qt uses mvcrt.dll for MSVS 2013 that does not support your Win XP SP2 anymore or you don't have d3dcompiler. Perhaps it will work with Qt 5.4 built with MSVS 2008 or MSVS 2012.

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文件有关.我已经提供了链接供您下载并置于可执行文件中.

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 - These errors relates to missing opengl32sw.dll file. Which i've already provided link for you to download and put to executable.

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

And app crashes because Qt was not able to run any of OpenGl modes at all. So basically all you can do is force app to use OpenGL software (i provided link for you how to do this numerous times, please read those guide.) or use qt 5.4 and try to run angle. OpenGL software may not run smoothly and have some problems with complex graphical interfaces but this is basically the only thing that is left.

这篇关于无法在Windows XP中使用QT5和VS2013创建的运​​行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 11:43