Search code examples
c++qtpthreadsqt-creatorqmake

Qt executable error- dll library


A Qt application which runs perfectly when executed from QtCreator, doesn't wont to run when I try to execute it from debug folder (without QtCreator). It asked for lots of .dll files and I downloaded them one by one,and added to debug folder. Now I got the error:

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

I can't find libwinpthread-1.dll anywhere on the internet. What did I do wrong?

The path to the executable is:

C:\Qt\Tools\QtCreator\bin\build-SimpleText1_3-Desktop_Qt_5_2_1_MinGW_32bit\Debug

The project file:

#-------------------------------------------------
#
# Project created by QtCreator 2014-04-04T14:29:48
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = SimpleText1_3
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui
CONFIG += console c++11
QMAKE_CXXFLAGS += -std=c++11

And main.cpp:

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

Solution

  • When you run your application in Qt Creator every thing is good but when you run your .exe file fro debug folder you get dll missing error. It`s True! First set Qt Creator to Release mode. You must copy these dll & the folder to Release folder:

    platforms --> Folder
    icudt52.dll
    icuin52.dll
    icuuc52.dll
    msvcp110.dll
    msvcr110.dll
    Qt5Core.dll
    Qt5Gui.dll
    Qt5Widgets.dll
    

    Above dll are for Visual Studio compiler & only Core & GUI library.

    Good Luck. Ya Ali.