Qt build to a single exe file without dlls
Solution 1
1.Why it works on my computer where I have developed that dialog, i.e. what is the problem?
Because you have VC Runtime installed on your computer.
There are two ways to solve this problem,
a.you need to compile QT and your exe with MultiThread(MT) instead of MultiThreadDLL(MTD).
b.install vc runtime on your friend's computer.
2.How can I get rid of all that .dll stuff buy compiling it into one .exe file easily?
You have to build all the QT dlls in to libs (whit MT), and link your exe with those libs.
It's time consuming. And you will still need windows dlls. Anyway, if you still want to link Qt statically these links may be very useful:
- http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc
- http://qt-project.org/doc/qt-4.8/deployment-windows.html
Solution 2
This links help me to find the solution. https://bugreports.qt-project.org/browse/QTBUG-28766
I was copy all the dll inside "C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin" directory but all solved after add the "platforms/qminimal.dll" and "platforms/qwindows.dll" to my .exe program.
Comments
-
Narek almost 2 years
I have written a simple dialog using Qt library on Widows 7. Now I need to send that
.exe
file to my friend so he could use that. But I need to send about 10.dll
files too so he could use it. I have found all them and sent, but he cannot open it. There is some "Visual C++ Runtime Error". Frankly speeking, in my other computer I can not open it either with the same error. I have googled a lot, and have found different answer such as:- Update DirectX
- Install The Microsoft Visual C++ 2010 Redistributable Package (vcredist_x86.exe)
But all this does not help me. So my questions are:
- Why it works on my computer where I have developed that dialog, i.e. what is the problem?
- How can I get rid of all that
.dll
stuff buy compiling it into one.exe
file easily?
-
Narek about 11 yearsBut I have tried to install VC Runtime (vcredist_x86.exe I guess) on my another computer, ad it does not help. Why?
-
drescherjm about 11 yearsMake sure you install the correct runtime for your compiler. There is a different runtime for x64 and 32bit also each compiler version and even service pack has a different runtime. On top of that make sure you built Qt with the exact same compiler that you built your application.
-
drescherjm about 11 yearsIf all of this is satisfied I would run depends.exe to try to determine what is missing.