How to generate or copy external dll to build or executable folder
-
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. -
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.
-
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.
-
@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#destdirFor example, if you add the line
DESTDIR = $${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 themake install
command after building your DLL.