在主可执行文件的子文件夹中部署一个Qt C ++共享库的DLL [英] Deploy a Qt C++ shared library's dll in subfolder of the main executable

查看:151
本文介绍了在主可执行文件的子文件夹中部署一个Qt C ++共享库的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Qt5 C ++项目,主要应用程序和(由我创建)共享库。它编译和执行,我可以部署它。问题是,通过部署我需要将我的共享库的编译DLL放在与主可执行文件相同的目录中。但是,我预先保持顶级文件夹相对干净,并将必要的文件放在相应的文件夹子树中。所以,我的问题是,我应该放在* .pro文件中,以便将dll的路径更改为myApp / myLib,其中myApp是主应用程序的可执行文件所在的文件夹。

解决方案

由于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆