Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt5Widgets.dll is missing? [duplicate]

I'm using Qt5 with the Qt Creator.

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

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

I'm new to Qt and have no idea what's causing this, didn't find any decent results from google. I've already tried reinstalling Qt5 (including the creator) but it 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 that's all the code I have.

like image 343
Patrik Lippojoki Avatar asked May 07 '13 19:05

Patrik Lippojoki


People also ask

How do I reinstall QT5WIDGETS dll?

Method 1: Download Qt5widgets. dll to PC from our site. Copy the file to the program install directory after where it is missing the DLL file. Or move the DLL file to the directory of your System (C:\Windows\System32, and for a 64 bit in C:\Windows\SysWOW64\). Now you need to reboot the computer.


2 Answers

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

You can't use addLibraryPath() for that purpose, because your program must be run before executing this method. And it can't run if it don't find mandatory library in the same folder.

You also need some other libraries to run a Qt5 program depending on the modules you use. Windows specific ones are listed here Statically linked app with QT gives error: Failed to load platform plugin "windows".

You may also need others libraries: - plugins/qjpeg.dll, etc. if you want to load images files in your GUI. - sqldrivers/qsqlite.dll, etc. if you use database (you need only drivers you use) For these, you can use addLibraryPath() to setup specific locations, but you should avoid this and try as most as possible to put them directly in the right sub-folder near your application.

You will find some information about libraries needed by each Qt5 modules on the web. You can also look in your favorite programs install folders to see what libraries are needed by them.

like image 198
Antwane Avatar answered Nov 15 '22 19:11

Antwane


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

like image 41
AnatolyS Avatar answered Nov 15 '22 18:11

AnatolyS