Qt5Widgets.dll missing?

I am using Qt5 with Qt Creator.

My program works fine if I run it from Qt Creator itself, but if I try to run the .exe from the debug or release folder, I will only get the error:

 The program can't start because Qt5Widgets.dll is missing from your computer. Try reinstalling the program to fix this problem. 

I am new to Qt and have no idea that because of this, I did not find decent results from Google. I already tried reinstalling Qt5 (including the creator), but that didn't help.


My .proj file looks like this:

 TEMPLATE = app TARGET = test QT += \ core \ gui \ widgets \ SOURCES += \ main.cpp 

And my main.cpp looks like this:

 #include <QApplication> #include <QWidget> int main(int argc, char **argv) { QApplication app(argc, argv); QWidget window(); window.show(); return app.exec(); } 

And all the code I have.

+6
source share
2 answers

When you run an application built with Qt, you need to have all the dll required by the Qt modules used in your code (Qt5Widgets.dll, Qt5Core.dll, etc.) in the same folder as your application.

You cannot use addLibraryPath () for this purpose, because your program must be running before this method executes. And it cannot work if it does not find the required library in the same folder.

You also need some other libraries to run the Qt5 program, depending on the modules you use. Windows-specific components are listed here. A statically linked application with QT gives an error: the platform plug-in and windows could not be loaded .

You may need other libraries as well: - plugins / qjpeg.dll, etc., if you want to upload image files to your GUI. - sqldrivers / qsqlite.dll, etc. if you are using a database (you only need the drivers you use). For this you can use addLibraryPath () to configure specific locations, but you should avoid this and try as much as possible to place them directly in the desired subfolder next to your application.

You will find information on the libraries required for each Qt5 module on the Internet. You can also look in your favorite folder installers to find out which libraries they need.

+1
source

I hope the following helps you understand why: http://doc.qt.io/qt-5/deployment.html

+1
source

Source: https://habr.com/ru/post/944470/


All Articles