简体   繁体   English

除非与图形处理器一起运行,否则Qt5 App会立即崩溃

[英]Qt5 App crashes instantly unless run with graphics processor

I have a Qt5 which uses QtCore, QtGui, QtWidgets, and QtMultimedia (for sound only) 我有一个Qt5,它使用QtCore,QtGui,QtWidgets和QtMultimedia(仅用于声音)

At first it compiled and ran fine, however now it crashes instantly. 最初,它可以编译并运行良好,但是现在它立即崩溃。 I have found that it runs fine under the following scenarios. 我发现它在以下情况下运行良好。

  • launched from QtCreator (debug and release) 从QtCreator启动(调试和发布)

  • launched from explorer (debug build only) 从资源管理器启动(仅调试构建)

The weird part is when i try to run the release build from explorer, it crashes instantly at start-up unless i run it by right clicking and selecting run with graphics processor. 奇怪的是,当我尝试从资源管理器运行发布版本时, 除非我通过右键单击并选择使用图形处理器运行来运行它, 否则它在启动时会立即崩溃。 (it doesn't matter which gpu I pick built in intel, or nvidea) (我选择的是内置intel或nvidea的GPU都没关系)

Looking at the debug log from QtCreator I can see that it loads among other dlls these three 查看来自QtCreator的调试日志,我可以看到它在其他三个dll中加载

sLibrary C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\detoured.dll loaded
sLibrary C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\Nvd3d9wrap.dll loaded
sLibrary C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvdxgiwrap.dll loaded

Is there something that I might have accidentally changed that would result in this behavior? 是否有我可能不小心更改了会导致此行为的内容? I'm not sure why it would have worked initially, and only started this behavior recently. 我不确定为什么最初会起作用,而只是最近才开始这种行为。

EDIT: I went through my git logs until I found the commit which broke it. 编辑:我遍历了git日志,直到找到破坏它的提交。 The only change in the Commit was that I removed CONFIG +=console from my project file. 提交中的唯一更改是我从项目文件中删除了CONFIG + = console。 I don't want to run my program with a console in the background, so I'm still looking for a fix. 我不想在后台使用控制台运行程序,因此我仍在寻找解决方案。

After Further investigation, I found in the debug log that qminimal.dll was being loaded, and then instantly unloaded. 经过进一步调查,我在调试日志中发现qminimal.dll已被加载,然后立即被卸载。 I found that I needed to move qminimal.dll into a platforms folder in the directory that my program was running from. 我发现我需要将qminimal.dll移到运行程序的目录中的platform文件夹中。

I am assuming that not having the console tells the app to use qminimal instead of some other dll. 我假设没有控制台告诉应用程序使用qminimal而不是其他一些dll。 The debug build was unaffected because it apparently always builds with a console. 调试构建不受影响,因为它显然总是使用控制台进行构建。

Obviously it worked from qtcreator because knew it had to load qminimal. 显然,它是从qtcreator运行的,因为它知道必须加载qminimal。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM