qtcreator - exe does work fine inside qtcreator bu

2020-02-10 00:46发布

I want to give a friend of mine a release build of a little project. It works perfectly fine when started from inside qtcreator, but doesn't open when double-clicked on the .exe file. It doesn't even give me an error message.

Now when I tried to copy a few Qt .dll files (like Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll) next to my exe file, it didn't change anything. How can I know what dependencies my project has? The .pro file doesn't tell me so much

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = project1
TEMPLATE = app


SOURCES += main.cpp\
    mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

I'm working on Windows 7 (64 bit), Qt Creator 2.6.1 based on Qt 5.0.0 (32 bit)

thanks for any help Sadik

edit: solution can be seen in my answer

4条回答
别忘想泡老子
2楼-- · 2020-02-10 00:51

Since you are talking about Qt5, make sure you have a platforms directory with at least qminimal.dll in it location in the directory of your program.exe file. They are part of the new changes made to Qt. (Possibly qwindows.dll as well).

Additionally, make sure you include the appropriate msvcr*.dll dlls if you do no compile with it statically linked. Check with dependency walker.

/myProgram.exe 
/Qt5Gui.dll
/Qt5Core.dll
/ .... (other DLLs you require)
/platforms/qminimal.dll
/platforms/qwindows.dll (Not always required)
查看更多
Explosion°爆炸
3楼-- · 2020-02-10 00:57

Solved it! All I had to do was to download "libEGL.dll" and put it in the directory where my exe file is located. Of course all the other .dll files from qt were needed, too. But these were explicitly mentioned in an error message. But for the "libEGL.dll" there is not even an error message. The .dll files that were listed in "dependency walker" can be ignored. For my problem this tool didn't really help. It didn't list the libEGL.dll but listed other .dll files which are in fact unused.

查看更多
可以哭但决不认输i
4楼-- · 2020-02-10 01:02
How can I know what dependencies my project has?

You can use program Dependency Walker from official site to see what dll's your program need.

NB Use Qt dlls of the same version (if you use Qt5, find your dlls from Qt5's bin directory and so on).

查看更多
放荡不羁爱自由
5楼-- · 2020-02-10 01:12

What compiler are you using? You need to bundle the runtime DLL files for the compiler or have the user install the Microsoft Visual C++ Redistributable Package if you're using MSVC++.

查看更多
登录 后发表回答