QT Visual Studio Release: how to make the .exe find dependencies
-
Hey, I have a QT program made in visual studio that I want to make a release for. I can do this and add dependencies such as QT5Core.dll by using windeployqt. No issues and the .exe of my program runs fine.
My issue is that I do not want all these dependencies in the same folder as the .exe. I have found how to make windeployqt put the dependencies in a separate folder:
The .exe cannot find the dependencies in the picture above. From what I understand the .exe is not a standalone executable. It is created first, then windeployqt adds the dependencies. But is there a setting for changing how the .exe is made so that it looks for a dependencies folder for its neccessary files?
-
It's not related to Qt or windeployqt and it's not about how the exe is made. Windows has a defined search order when it loads linked dynamic libraries. Other dlls, like plugins or resources, that load later on demand can be relocated via qtconf file.
In short - that's just how Windows organizes dlls.
You can fiddle with the local startup environment e.g. make a batch script that adds the dependencies subdirectory to PATH or changes working dir and you'd start your app by running it, but it's quite unusual and ugly.I'd say just get used to having bunch of dlls next to your exe, even if it's not to your taste. That's what Windows apps do.
-