This is a bug on Windows:
https://bugreports.qt-project.org/browse/QTBUG-28766
Specifically, Qt only looks for qwindows.dll (which is required despite what depends.exe
says - it is dynamically loaded) in the hard-coded absolute path that it is installed in on your development machine, i.e. c:\Qt\.....\plugins\platforms
. There is a file called qt.conf which you are supposed to be able to use to change the search paths but it does not work.
Fortunately Joost Bloemen came up with a workaround in that bug report:
...
#include <windows.h>
#include <QFileInfo>
int main(int argc, char* argv[])
{
// Bug workaround. See https://bugreports.qt-project.org/browse/QTBUG-28766
wchar_t dirpath[MAX_PATH];
GetModuleFileName(0, dirpath, MAX_PATH);
QFileInfo dir(QString::fromWCharArray(dirpath));
QApplication::addLibraryPath(dir.absolutePath());
QApplication a(argc, argv);
...
And then put qwindows.dll
(you don't need qminimal.dll
) in a subdirectory of your EXE called platforms
. (You can put it in .\plugins\platforms
instead if you like, then you just need to change dir.absolutePath()
to dir.absolutePath() + "/plugins"
above.