[SOLVED] Program EXE runs in Qt Creator but can't find DLLs when run outside of Qt Creator



  • I created a simple app for testing consisting of a test.pro file, a test.qrc file, main.cpp and main.qml. When I build and run this on Windows 8 64 bit using Qt 5.3.0, Qt Creator and MinGW 32 bit, it creates a Test.exe file and runs it. However, when I try to run Test.exe outside of Qt Creator it complains that "The program can't start because Qt5Core.dll is missing from your computer. Try reinstalling the program to fix this program." main.o, qrc_test.cpp and qrc_test.o are also in the build's release directory created by Qt Creator.

    Looking at some of the posts it seems like one way to resolve this is to copy the missing DLLs to where Test.exe resides. This requires identifying all the DLLs and then copying them. I tried to copy Qt5Core.dll from the 5.3/mingw482_32/bin directory into plugins/platforms as suggested but it didn't work. I then copied it to platforms, also as suggested, but it didn't work. I then copied it into the same directory as Test.exe and then had an error for Qt5Gui.dll. I assume it will complain until I copy all of the required DLLs. I examined Test.exe and it does contain a list of DLLs. Is this an internal manifest?

    Is there any way to get Test.exe to run without copying the required DLLs? How does Qt Creator successfully run Test.exe?

    Thanks.



  • You can add the directories where Qt libraries reside to the system PATH

    [quote]How does Qt Creator successfully run Test.exe?[/quote]
    QtCreator modifies the environment to make all Qt libraries available before starting an application.


  • Lifetime Qt Champion

    Hi,

    Qt Creator modifies the PATH environment variable to ensure your software finds the right Qt version.

    Did you already had a look at this very good wiki "entry":http://qt-project.org/wiki/Deploy_an_Application_on_Windows ?



  • I wasn't aware of the article but will look at it. I created a simple batch file runTest.bat with the following and it works.
    @
    set PATH=C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;%PATH%
    Test.exe
    @

    Thank you both.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.