在主可执行文件的子文件夹中部署一个Qt C ++共享库的DLL [英] Deploy a Qt C++ shared library's dll in subfolder of the main executable
问题描述
由于Windows对您的程序进行了DLL的搜索,而不是程序本身,您无法将makefile放在哪里搜索库。 p>
然而,您可以:
- 添加所需的文件夹, PATH。
- 创建启动脚本,设置库的路径,然后启动程序。
- 静态编译,如果您遵守使用LPGL或Qt商业许可证,取决于您的情况。
作为备注:Qt插件可以做你想要的,但核心依赖不是Qt插件本身。
I have a Qt5 C++ project with a main app and a (created by me) shared library. It compiles and executes and I am able to deploy it. The issue is, that by deployment I need to put the compiled dll of my shared library in the same directory as the main executable. However, I preffer to keep the top level folder relatively clean and put the necessary files in an appropriate sub-tree of folders. So, my question is, what should I put in the *.pro file in order to change the path of the dll to myApp/myLib, where myApp is the folder where the main app's executable resides.
Since Windows does the search of DLL's for your program, and not the program itself, you can't tell your makefile where to search for the libraries.
You can, however:
- Add the desired folder where the dll's go to the PATH.
- Make a startup script, that sets the path where the libraries are, and then start the program.
- Compile statically, if you comply with the LPGL or Qt Comercial license, depending your case.
As a side note: Qt Plugins does what you want, but core dependencies aren't Qt plugins themselves.
这篇关于在主可执行文件的子文件夹中部署一个Qt C ++共享库的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!