Poken1151
Poken1151

Reputation: 580

OpenGL Widget works in creator but black when launched from .exe

I have been working on a Qt OpenGL project for a bit now for some school work. I had to re-build Qt 5.0.1 for my windows machine so I could use OpenGL proper. At the end of this project I need to turn over the files and any executables, so I figured I could take the release .exe and stick it in a .zip for use.

I followed instructions online of making sure I place any needed .dll's into the .exe's dir. For my project there are 10: icudt49, icuin49, icuuc49, libEGL, libGLESv2, Qt5Core, Qt5Gui, Qt5OpenGL and Qt5Widgets

I took these files all from: C:\Qt\Qt5.0.1\5.0.1\msvc2010\bin

on my system.

Issue is the .exe will run and I get the UI and all. But the OpenGL scene is just black. I can still click objects in the scene, evidently zoom in and out and all that. I assume thats just the Qt translating the commands still. But nothing is visible. I'm unsure what the problem can be because it all works fine when launched from the creator.

EDIT: So, with all the dlls in the release folder, running the project from within creator will also have a black screen, when I remove them, it runs well. So perhaps one of the dll's is just wrong?

Also: I looked online about publishing with Qt Creator and found not too much aid, said I should start from completely rebuilding Qt Creator staticly, but I'm sure the guide I had followed did this, however I still can't publish from the build menu, so I stuck with the above method.

Upvotes: 2

Views: 1390

Answers (2)

Poken1151
Poken1151

Reputation: 580

So the ultimate issue was the use of the correct DLLs. Using something like DependenyWalker can help you to note which DLLs may be missing, however it did nothing in my case.

I had installed Qt once, and also rebuilt, uninstalled and re-installed it. However all the libraries it was calling from as no longer in C:\Qt\Qt5.0.1\5.0.1\msvc2010\bin as expected, it was calling from the github repository where I built it C:\Users\User\Documents\GitHub\qt5. Once this is sorted out, it still required a framework folder and then it works as expected.

1) Copy the correct DLL files to the release folder of the build.

2) Create a folder in the same dir as the .exe named "platforms". (Note: elsewhere has said create plugins>platforms, but this will not work with newer Qt versions)

3) From the same source you got the other DLLs, copy qwindows.dll to the platforms folder you created.

4) Run the executable and enjoy.

As long as the system you're running on is capable of your OpenGL structure, it should be fine.

Upvotes: 0

Konrad Kleine
Konrad Kleine

Reputation: 4479

I suggest, that you open every of the DDLs in your Zip file with Dependency Walker (http://www.dependencywalker.com/). It should display information about dependencies from one of your QtXXX.dll files to other files. If one of the dependencies is missing, you know where to look next. You can also try to open your executable with Dependency Walker. I haven't used the program for a long time so I don't remember if opening an executable is the only way it works. Anyway, here are the reasons why you might want to use the tool: http://www.dependencywalker.com/help/html/overview_1.htm

This question might also be helpful:

At least one module has an unresolved import due to a missing export function in an implicitly dependent module

Good luck!

Upvotes: 1

Related Questions