Qt World Summit: Submit your Presentation

How to distribute a DLL developed using the Qt Core and GUI

  • Hi,

    I create a Dll , that will be used by other applications outside of Qt enviroment , and usually my dll´s goes with a .lib file, the .dll file itself and all the Include files insde of the Include folder.

    But this dll uses QString and QVector2S objects declared in core and gui components, so i will need redistribute the dll´s too, but the include files? This is the first time i try redistribute a dll created in Qt.

    I need redistribute all Qt include files? How this can be made? probabli this objects have theire dependencies...etc...

    Any help?
    Kind Regards.

  • @Wolff Hi, I'd start by including QtCore and QtGui dll files. If that still doesn't work (almost certainly will fail, there are other dlls that might be needed) you can use DependencyWalker to see what's missing. Should not be much more than those two files though.

  • @artwaw , my problem is not distribute the dll, but the system who will use my Dll will have a Header file with #include<QString> , for example, and this system will not find.
    My concern is there is a way to get only the used header files, like we do with windeployqt.exe or something like that...
    If not i will need create an include folder with the dll´s and copy there all the necessary include files etc...

  • Lifetime Qt Champion


    Does your library use these classes only internally or do they expose it in its API ?

  • @SGaist , expose it, becouse i´m using it on the Library Interface object being exported by by the Dll.

  • @SGaist , For example, one of the main Dll functions receive a QString object informing the path to load some files. when i try compile it on the target system i will receive am compilation error not finding the QString object, etc...

  • @SGaist , just to complement, when i create the dll, the declaratrions os ExportDll are using the #include <QtCore/qglobal.h> so basically how i can develop an C++ dll API to be used in in other systems using other C++ Compilers, etc? what is the best way to do that? remove everything related to Qt , including the External Macros and make it ANSI? , or i have an way to distribute the Qt Libraries that make possible i distribute it with my dll?

  • Lifetime Qt Champion

    If you expose Qt classes with you either have to point your users to the Qt SDK or provide your own minimal SDK that includes the modules you are using (with header and all).

    For multiple compilers support you'll have to do the same as Qt and provide your library for all the ones you want to support.

    Another possibility is to use a tool like Conan to distribute it.

  • @SGaist , Thanks so much!
    I will take a look at conan , however i think is better replace the Qt objects with standard data. they are being used only for Dll interface.

    Again, Thanks so Much!
    This thread can be considered closed. ;)

  • Lifetime Qt Champion

    You can still use Qt for the backend, just use standard STD types in the API and you'll just have to deploy the required .dlls.

    Good luck :-)

Log in to reply