Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] Importing necessary dlls to application



  • Hi,
    I reached the final step of my application now, I try to run it on any other computer then mine (i.e. there's no Qt stuff or mingw_32 stuff installed).
    Well, when trying to run the program, I get several errors:
    "Missing Qt5Core.dll"
    "Missing libgcc_s_dw2-1.dll"
    "Missing ....dll"
    and so on

    It is really dirty to copy and paste all those .dlls into the Application's working directory. Instead, I'd like to include them into my application.
    Problem is, I don't know how to do that... Has that anything to do with static library linking? But I thought I can only link libraries with suffix ".a" statically, wrong?

    Another solution would be something like an install routine, but I don't know how to do that (like importing the .dlls and installing them (exporting) on the other computer...

    Can anyone help me with that?


  • Moderators

    Please see the official "deployment guide":http://qt-project.org/doc/qt-5/windows-deployment.html, especially the part about the deployment tool.

    Static linking is possible, but hard to achieve. It is also believed to be incompatible with LGPL license, so unless you are a commercial customer, or your application is Open Source, you can encounter legal problems.



  • Well, isn't there a simple way to import the dlls into my program and export ("install") them on the other computer?
    Before I started coding in C++, I coded with the script language Autohotkey, and there was a simple one-liner command to import any kind of file into my program and export it to the typed destination:
    @FileInstall, soure_file_path, dest_file_path@
    So how is that possible? I don't want to use a "big" installer, I'd like to do that on my own, just to import a hand full of dll files and export them later... Autohotkey itsself is written in c++, so there has to be a way to do that..

    Any solutions?


  • Moderators

    Please read the link I have provided. You can use the windeployqt tool, which is a one-liner ;-)



  • Thank's for that! Now I have all the stuff I need to carry with my executable.
    But that will not finally solve my problem, because I'd really like to import all those files into my executable, so I can upload the executable to my website and a user can simply download and run it.
    There must be a way to import those files into the executable and export them on users computer to a specific destination... Like an installer, but it should be possible to do it without external tools...


  • Moderators

    [quote author="Binary91" date="1415626008"]it should be possible to do it without external tools...[/quote]

    maybe it should, but it is not possible right now.

    As said, you can try static compilation, but it is not easy to make it work.



  • Oh my god, that sucks a bit.. Well, then I'll have to settle for the solution above, offering my program as a folder like it would be after an installation...

    Thank you for your support! :-)


  • Moderators

    You can pack it into a zip, or even to sfx to make it self-executable. But that is still an additional step.



  • Yep, already done. So at least, it's only one file :-P



  • Hi again,
    at least, I spent a little time reading the source of AutoHotkey and its command "FileInstall".
    Combining that with rummaging the windows MSDN website, I noticed the windows resource system (http://msdn.microsoft.com/en-us/library/windows/desktop/ff468900(v=vs.85).aspx).

    I changed the pure C code and adjusted it to Qt standard. The result is a useful class that allows simple usage of an import/export routine to create setup files and extract its contents on other computers.
    Only problem is, that this code might be Windows dependent. For those who are interested in a platform independent way, feel free to help yourself :-P

    You can find the library and the User Interface I did on "this Wiki page":http://qt-project.org/wiki/Import-Export-resources-for-setup-creation :-)








Log in to reply