How to run Qt 5 applications on other computers (Windows 7)

后端 未结 4 1536
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 23:59

I have developed a simple application with Qt 5.0.2 on Windows 7 Ultimate. As a compiler the QtCreator used MSVC2012_64bit. And I cannot move my application onto other compu

相关标签:
4条回答
  • 2020-12-16 00:37

    Thanks for your help folks!

    For me, just adding qwindows.dll to the /platforms directory somehow didn't cut it.
    I finally got everything to work by bluntly copying the entire plugins directory to my application's binary directory and creating a qt.conf file with the following content:

    [Paths]
    Plugins=./plugins
    
    0 讨论(0)
  • 2020-12-16 00:42

    just add the file qt.conf to your app dir with the following content

    [Paths]
    
    Libraries=./platforms
    

    then copy, to same app dir, the subdir "platforms" that you will find into dir C:\Qt\Qt5.1.1\Tools\QtCreator\bin

    That's all.

    This solves because qtcore.dll is compiled with internal paths of your qt instalation. (I dont know wy !). Since, qt.conf is allways read by qtcore when the app starts the librarys in "platforms" will be included and the app works at all on anyone host.

    Warning: the qtcore and platforms sub dir have to became from the same qt instalation.

    Sorry by the English but the solution works fine.

    0 讨论(0)
  • 2020-12-16 00:42

    Qt these days (as of at least Qt 5.2, if not earlier) ships with "windeployqt.exe", which when pointed at your compiled program (and, if like me you're using them, as an additional argument of "--qmldir path/to/QML/files" for a Qt Quick program) should spit out all the required DLLs into the same directory as your compiled program currently resides. So for myself on a local build machine for example, I ran something along the lines of:

        windeployqt --qmldir C:\Code\AppSource C:\Code\build-msvc2010\release
    

    This is with the Qt \bin directory in my $PATH (or, I guess in Windows parlance, %PATH% ;)) using Qt 5.5, although I've done the same back with 5.2 and 5.3 as well.

    IIRC if using MSVC as the compiler I still needed to copy those DLLs (in my case, msvc2010, so msvcp100.dll and msvcr100.dll) manually, but I could be remembering wrong.

    0 讨论(0)
  • 2020-12-16 00:50

    This the list of dlls I needed and also I have copied the C:\Qt\Qt5.0.2\5.0.2\mingw47_32\plugins\platforms folder:

    enter image description here

    Just this and it worked for me. BTW I use Windows 7 Ultimate 64x, and Qt 5.0.2 for Windows 32-bit (MinGW 4.7, 650 MB) package for Qt.

    EDIT: You might also need QtCreator's .dll to be copied and also you might need to have a file named qt.conf with the following content (copied from @Renato answer):

    [Paths]
    
    Libraries=./platforms
    
    0 讨论(0)
提交回复
热议问题