standalone exe in Qt - qt

I want to make a standalone .exe file in Qt msvc 2010 5. I change the mode to "release" and build my project and I copy the .exe file in release/debug folder to bin directory in Qt directory and then I copy all the bin folder. it works properly in my computer, but when I move the bin folder to other computers the .exe file doesn't work. I installed visual c++ 2010 redistributable package in the other computer but still it doesn't work. what should I do?

The answer is most likely that the other machine doesn't have Qt installed. If you want a wholly standalone Qt app on Windows (statically linked), check this out: http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows
Some quick build instructions -
Make sure you have python installed and in your path Get the Qt
source code
(http://download.qt-project.org/official_releases/qt/5.1/5.1.1/single/qt-everywhere-opensource-src-5.1.1.zip)
unzip the zip file and open a Visual Studio command prompt in that
directory
execute configure -static -release -no-audio-backend
-opengl desktop -opensource -confirm-license
execute nmake (this will compile all of Qt and will take a while depending on your processing power)
add CONFIG+=static to your .pro file call qmake from the build of qt you
just made and then run nmake on your project. You'll then get a
statically linked binary. You'll know because even a very small
program will be > 5MB in size.

Related

Can not load library Qt5Widgets.dll

Error when run FBLTool_0224.exe
I guess you double-clicked in exe file that provides after building in release mode :
For Deploy and create Exe output with QT in windows you should follow this way:
put your compiler path in your system path. now you use mingw81_64 you should set it. something like Qt/tools/mingw81_64/bin
copy exe file that provides after building in release mode in one folder and run mingw81_64 cmd (it has separate cmd)
and cd to that folder path
windeployqt app.exe
This command will get all dll needs for your app and your exe will work .
if you use qml
windeployqt --qmldir (the path of its directory ) app.exe
and also see these youtube videos for more info:
https://www.youtube.com/watch?v=LdSTgR0xJco
https://www.youtube.com/watch?v=hCXAgB6y8eA
installing visual C++ 2010 runtime x86 solved problem

How to deploy QT application with OpenSSL

When I run the application from the directory that it was built in, there is no problem but when I try to run the application from another directory, after carrying the exe file in it, OpenSSL does not work.
I copied libcrypto-1_1-x64.dll and libssl-1_1-x64.dll files in the same directory, windeployqt takes care of the other dlls. What could be missing? If it's necessary, how do I make the configuration for the runtime?
OpenSSL libraries are precompiled with Qt via Qt Maintenance Tool. Because it's a C library it doesn't matter if is MSVC or MingW compiler. This little guide should work:
Install OpenSSL from Maintenance Tool.
Independently of your compiler, go to C:\Qt\Tools\OpenSSL\Win_x64\bin (if you have 64 bits application).
Copy libcrypto-1_1-x64.dll and libssl-1_1-x64.dll and paste in your release or debug application executable.

mingwm10.dll missing in the bin folder

I was trying to create a exe file of my Qt project.
I found this post: How to create executable file for a Qt Application?
and realised that i dont have a mingwm10.dll file in that directory.
Are there any other ways of creating a exe file or any other location where mingwm10.dll might be located?
I am using qt 5.6.
mingwm10.dll is a runtime file for the MinGW.org toolchain. Qt moved towards a MinGW-w64-based toolchain (which is essentially an expanded and newer implementation of the Win32 headers and import libraries), which doesn't have this runtime dependency. Ignore it, you don't need it. You might need the libgcc and libstdc++ DLLs though, but that's the same with any (non-statically built) toolchain.
Note you can use the windeployqt utility to automatically copy over all runtime depencies of an executable. You can enable it by adding windeployqt to CONFIG if you're using qmake, or you could just run it yourself:
windeployqt my_app.exe
This command will copy all DLLs (including the Qt platform plugins etc.) so that the application can be run by e.g. double-clicking, instead of only in the specific environment of an IDE.

how to configure and deploy QT to run platform independently?

I am new to QT. I am using "qt creator 5" with "opencv" on ubuntu 13.04. I want to run program written and executed on my machine is to be executed as well on other windows and Ubuntu machine.
thanks in advance
On Linux:
You should place Qt so files along the release version of your executable. These are libQtCore.so, libQtGui.so and possibly the ones for other modules that you have used. These so files are in your installed Qt Directory in lib folder or in director /usr/lib/i386-linux-gnu. If you are using plugins you should place their so files in a folder named plugins beside your binary. In case of using icons and images you should ship their so files like libqico.so and libqsvg.so in a folder named imageformats.
On Windows:
You can compile your code on Windows using Qt Creator and Microsoft Visual C++ Compiler.
You should place Qt DLLs along the release version of your executable. These are Qt5Core.dll, Qt5Gui.dll and possibly the ones for other modules that you have used. These dll files are in your installed Qt Directory in bin folder. You should also place msvcr100.dll and msvcp100.dll in case you are using MSVS2010. If you are using plugins you should place their dll in a folder named plugins beside your exe. In case of using icons and images you should ship their dlls like qico.dll and qsvg.dll in a folder named imageformats.

Building Qt 4.7.3 (latest) on windows

I have downloaded the open source version of Qt 4.7.3, run configure.exe to configure it, how do I then build it (to have a qmake.exe I can use) on windows?
if you do configure -platform win32-msvc2010 (or2008 etc) it will generate a vs2010 project, just open the .sln and built it.
configure.exe should have caused qmake.exe to build. You'll want to add its location to your path. (It's in the bin directory of your Qt installation).

Resources