Why do I have to copy mingw DLLs manually when using windeployqt? - windows

Just downloaded Qt Creator and compiled my application.
I am using windeployqt on the command line since I did not find any option in Qt creator itself.
When I use it on my binary I still have to copy DLLs like libgcc_s_seh-1.dll, libstdc++-6.dll and libwinpthread-1.dll from my Qt installation directory C:\Qt\6.2.2\mingw_64\bin into my deployment directory or otherwise I cannot start the .exe file.
The same happens if I am trying to start it in my target build directory without the Qt Creator.
Shouldn't windeployqt or the Qt Creator copy those DLLs into the build and deployment directory, so you can run the .exe properly?!

Related

Qt 5.15 mingw missing debug dlls *d.dll in folder bin

i installed Qt Creator with Qt5.15 by Qt maintenance tool and i`m missing the debug dlls like QtCored.dll in my bin folder of mingw...what can i do?

cmake set exe library path

I have cmake app which build an window exe. On windows os.
add_executable(app ${app_SRC})
SET_TARGET_PROPERTIES(app PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS")
target_include_directories(app PRIVATE ${wxWidgets_INCLUDE_DIRS})
target_link_libraries(app ${wxWidgets_LIBRARIES})
It build app.exe success. But when I run app.exe. The error dialog show:
Can't find wxbase314ud_vc_custom.dll.
How can I config the dll path?
I know I can copy the dlls to the exe folder, but is there any other way to do this in CMakeLists.txt?

How to build a qt project from command line?

I've seen similar questions, but they all address slightly different situations than my own.
I have the source code for a qt project on a github repo, including the .pro file. Basically, I want to know if it's possible for someone on a Windows machine to clone the repo and build the executable from the source code without downloading and configuring Qt Creator. If it is possible, what prerequisites need to be met, and what steps need to be taken in order to build the project? The project uses qmake and not cmake, which probably affects the answer.
Install Qt. Download and install Git for Windows. In Git Bash, go to a folder you want to use for a project. Execute the command git clone. Run Start -> Qt<version> -> Qt Command Prompt. CD to this directory and execute:
qmake <your_project.pro>
mingw32-make
or if you are using MSVC, commands should be
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
qmake <your_project.pro>
nmake

Qt on windows with mingw and no MSVC redistributable?

Qt supports compiling all including qml without MSVC. So how to install qt creator and qt studio without them, how to create qt package that will not rely on MSVC at all?
You could build QtCreator with mingw and distribute it in your classroom : take a look at the Readme https://github.com/qt-creator/qt-creator
If you cannot install MSVC redistributable run times, you can either build your own package using MinGW (see other answers, but note that you only need to rebuild Qt Creator and Qt 3D Studio, not Qt intself).
Or you can install the official packages that do depends on MSVC runtimes (for QtCreator and Qt Studio) and instead of installing the MSVC Redistributable Package, you can copy paste the required DLLs to the installation folder (e.g C:\Qt\Tools\QtCreator\bin for Qt Creator).
For Qt Creator it seems that you will need:
MSVCP140.DLL
VCRUNTIME140.DLL
You can check the missing DLLs using Dependency Walker or similar tools.
Note that if copying the DLLs around is not recommended by Microsoft, but it does work. And it is less cumbersome that rebuilding Qt Creator.
It's also possible to directly install redistributable Visual C++ DLLs
in the application local folder, which is the folder that contains
your executable application file. For servicing reasons, we do not
recommend that you use this installation location.
https://learn.microsoft.com/en-us/cpp/ide/redistributing-visual-cpp-files

C++ Program compiled with QT does not find automatically QT dlls in Windows

I have succesfully compiled a QT program for windows. I can not directly run the program in the build directory. The Dependency Walker shows that the paths to Qt5Gui.dll Qt5Widgets.dll Qt5Core.dll are not found. I am copying the dlls to the build directory and the program runs as expected. My question is how can I avoid copying the dlls in the build directory. Is there an option that I should add to the CMakeLists.txt to help in this situation ? I am using windows 10.

Resources