How to embed DLL file in one executable file ?
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.
Zlatomir last edited by
You can use and installer (like "nsis":http://nsis.sourceforge.net/Main_Page) 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
Zlatomir last edited by
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":http://doc.qt.nokia.com/latest/deployment-windows.html is a documentation link about the windows deployment (contains information about static build too)
hirakjyoti last edited by
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":http://qt.nokia.com/downloads . 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":http://www.jrsoftware.org/isinfo.php (install the QuickStart Pack). Setting up an installer with Inno Setup is very easy.
tobias.hunger last edited by
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:-)
Mike_Really last edited by
Anyway, if you want to embed dll, it is actually possible. The type of these solutions are application virtualization tools. E.g. "boxedapp":http://boxedapp.com provides such function.
Of course, it's clear that you must follow licensing restrictions if any.
Hope it helps.