Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to generate or copy external dll to build or executable folder

How to generate or copy external dll to build or executable folder

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Make it GREAT again
    wrote on last edited by
    #1

    Hello,

    It seems to be an old question, but I don't find a clear solution by far.
    I have checked this https://doc.qt.io/archives/qt-4.8/qmake-environment-reference.html#installs
    but don't solve my problem.
    I have a very very simple project, with which few external libraries were built. Anyway, suppose I have only one external library in a test. The project can be built without an error. The executable file can be launched in Debug mode within QtCreator, but failed undoubtedly via a direct double-click in the build folder because of missing .dll files of external library. I just want to compile the project and meanwhile copy or generate those libraries added to the project into the executable or build directory.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jakob Weiss
      wrote on last edited by
      #2

      You can check out the deployment tool for windows, which should automatically collect the necessary Qt dlls for your application: https://doc.qt.io/Qt-5/windows-deployment.html

      You should be able to use this as a custom build step in your build system if you really want to, or just do it once manually.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Make it GREAT again
        wrote on last edited by Make it GREAT again
        #3

        Thanks, @Jakob-Weiss . I am using 5.4 and really don't want to update everything installed. I don't have a mingw version qtx.x-for-desktop so that I give the path of windeploy to the PATH variable. I m still stuck on this for almost one week. How stupid!!!

        D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin>path
        PATH=D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin
        
        D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin>windeployqt.exe \guis\build-AllNewDifroame
        rGUI-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Release\release
        Unable to find dependent libraries of D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin\Qt5D
        ataVisualization.dll :Cannot open 'D:/Qt/Qt5.4.1/5.4/msvc2013_opengl/bin/Qt5Data
        Visualization.dll':
        D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin>
        
        
        

        I have also tried some other ways:

        QtDV.command = copy $$QtDV_LIB_DIR/*.dll $$DESTDIR
                message($$QtDV.commands)
            QMAKE_POST_LINK = QtDV.command
        

        This one gives me an syntex error like this

        copy D:/GUIs/AllNewDifroamerGUI/../build-qtdatavis3d-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug/lib/*d.dll
        

        That is same to the one 10 years ago. https://forum.qt.io/topic/5159/copying-supporting-dll-to-destdir

        BTW, message($$DESTDIR) shows nothing.

        JKSHJ 1 Reply Last reply
        0
        • M Make it GREAT again

          Thanks, @Jakob-Weiss . I am using 5.4 and really don't want to update everything installed. I don't have a mingw version qtx.x-for-desktop so that I give the path of windeploy to the PATH variable. I m still stuck on this for almost one week. How stupid!!!

          D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin>path
          PATH=D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin
          
          D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin>windeployqt.exe \guis\build-AllNewDifroame
          rGUI-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Release\release
          Unable to find dependent libraries of D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin\Qt5D
          ataVisualization.dll :Cannot open 'D:/Qt/Qt5.4.1/5.4/msvc2013_opengl/bin/Qt5Data
          Visualization.dll':
          D:\Qt\Qt5.4.1\5.4\msvc2013_opengl\bin>
          
          
          

          I have also tried some other ways:

          QtDV.command = copy $$QtDV_LIB_DIR/*.dll $$DESTDIR
                  message($$QtDV.commands)
              QMAKE_POST_LINK = QtDV.command
          

          This one gives me an syntex error like this

          copy D:/GUIs/AllNewDifroamerGUI/../build-qtdatavis3d-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug/lib/*d.dll
          

          That is same to the one 10 years ago. https://forum.qt.io/topic/5159/copying-supporting-dll-to-destdir

          BTW, message($$DESTDIR) shows nothing.

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by JKSH
          #4

          @Make-it-GREAT-again said in How to generate or copy external dll to build or executable folder:

          BTW, message($$DESTDIR) shows nothing

          Did you define DESTDIR in your *.pro file? See https://doc.qt.io/qt-5/qmake-variable-reference.html#destdir

          For example, if you add the lineDESTDIR = $${PWD}/../bin in your pro file at D:\Projects\MyDll\src\mydll.pro, then when you build your DLL it will automatically be placed in D:\Projects\MyDll\bin\

          I have checked this https://doc.qt.io/archives/qt-4.8/qmake-environment-reference.html#installs
          but don't solve my problem.

          To use the INSTALLS variable, run the make install command after building your DLL.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved