Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a Qt application on Windows?

I'm new to Qt and cannot figure out how to deploy a simple Qt application on Windows. It runs fine when run from inside Qt Creator, but it won't run when directly executed. I have the newest version of the Qt SDK installed and am using all of the default settings.

I have read dozens of "how to" guides, all of which provided conflicting information, in addition to dozens upon dozens of forum threads, blog posts, and questions on here. I simply cannot find instructions that clearly explain how to deploy a Qt application on Windows.

I tried putting all the DLLs I could find in the application directory, but that didn't work. I also tried building Qt statically, but that didn't work either.

Can anyone help me out?

EDIT: Thank you both for your replies. Here is some additional information:

I am using "Qt Creator 2.4.1, Based on Qt 4.7.4"

I have the following includes across different files:

#include <QtGui/QApplication>
#include <QDebug>
#include <QTextEdit>
#include <QtGui>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include "qthread.h"
#include "windows.h"
#include <QMessageBox>

I'm using the default compiler that came with Qt, MinGW.

like image 658
Nate Avatar asked Dec 08 '25 13:12

Nate


1 Answers

The simple solution is to include the Qt dlls with your deployment, placing them in the same location as the executable. Be aware that Qt uses different dlls for release vs. debug builds, so don't accidentally deploy a debug build.

Using static libraries is also viable. Your edit states you've tried both static and same-directory deployment. If neither of these (especially the static build) are working, you're doing something seriously wrong and it's rather difficult to debug over a board like SO.

like image 186
mah Avatar answered Dec 10 '25 05:12

mah