如何嵌入Qt资源到.dll文件? [英] How can I embed a Qt resource into a .dll file?

查看:489
本文介绍了如何嵌入Qt资源到.dll文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有数百个HTML文件,我不想将所有这些HTML文件编译成.exe。因此,我想把我的HTML文件改成.dll文件。

I have hundreds of HTML files in my project, and I don't want to compile all of these HTML files into an .exe. Therefore I'd like to build my HTML files into a .dll file instead.

如何将这样的Qt资源嵌入到.dll文件或其他类型的编译库?

How can I embed such a Qt resource into a .dll file or other type of compiled library?

推荐答案

您要仅将该dll文件用于dll文件还是要包含代码吗?如果dll仅用于html文件,请创建外部外部资源文件

Are you going to use the dll only for the html files or is it going to contain code too? If the dll would be only for the html files, create an external external resource file instead.

将qrc文件编译为外部资源文件:

Compile the qrc file to external resource file:

rcc -binary myresource.qrc -o myresource.rcc

在exe中注册资源文件:

Register the resource file in your exe:

QResource::registerResource("/path/to/myresource.rcc");

这篇关于如何嵌入Qt资源到.dll文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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