Important: Please read the Qt Code of Conduct -

How to embed DLL file in one executable file ?

  • Hi All,

    I have three DLL files that my project depends on and after successful compilation i get one executable file but when i double click on that executable file in debug folder that tells us to copy QtCored4.dll,and other DLL file in debug folder so is there any way i can embed DLL in executable file ? so Every time i need not copy DLL in every folder.


  • You cannot embed dlls in your program. If you have the sources of the libraries you can create a static library. In any case, you can add the Qt binary dir to your PATH, thereby removing the need to copy the libraries every time.

  • That is right i agree with you.
    But if i want to send exe to another person and that person has not installed Qt in his machine then what should be the solution ?
    I want to send ONLY exe to another person so when he/she double click on exe then in that folder temporory DLL is extract and execute the exe.


  • Build the static library or take the steps necessary to add the dll copy step to your build process. Note that you shouldn't distribute debug builds, as the debug run-time may not be present on the receiving system.

  • You can use and installer (like "nsis": and use this to share your application with all the .dll files.

  • Not able to understand.
    can u please give me proper steps . I am using visual studio.
    I have tried to build Qt project as static but after that exe also want DLL file

  • Before you can static build your application (so that it doesn't require dll) you need to static build the Qt framework (because as Franzk said you can't embed the dll into your exe) - you need the static libraries built before you can build a static exe. "here": is a documentation link about the windows deployment (contains information about static build too)

  • Instead of double clicking on the executable file you can open Qt Command Prompt (if Windows) , then in the Qt Command Prompt go to debug folder & type your executable file name...

  • to link Qt statically, you have to rebuild Qt completly from the sources.
    There are descriptions on the Devnet wiki and the Qt docs about how to do that.

    Thats the only way to get one executable without dependencies. But building Qt takes some hours.

    First you have to download the Qt sources zip file from "here": . In the text, there is a link behind the word zip :-)

  • I do not recommend static linking. It has some disadvantages and hassles to setup. And - depending on the tool chain you use - it may not be sufficient at all, as you will have to deliver additional DLLs (eg. openssl or the like).

    Instead, create an installer for Windows, NSIS was mentioned earlier, I can reommend "Inno Setup": (install the QuickStart Pack). Setting up an installer with Inno Setup is very easy.

  • Moderators

    In addition static linking will limit your licensing options. Please review your license terms before deciding on static linking.

    From my understanding you will either need a commercial license of Qt or put your application under GPL if you do static linking against Qt. But then I am not a lawyer: Please consult yours and do not follow random legal advise found on the internet:-)

  • Anyway, if you want to embed dll, it is actually possible. The type of these solutions are application virtualization tools. E.g. "boxedapp": provides such function.

    Of course, it's clear that you must follow licensing restrictions if any.

    Hope it helps.


Log in to reply