当前位置:网站首页>QT笔记——vs + qt 创建一个带界面的 dll 和 调用带界面的dll
QT笔记——vs + qt 创建一个带界面的 dll 和 调用带界面的dll
2022-08-10 21:25:00 【旧街凉风°】
用VS + qt 生成dll 和 调用生成的dll
环境: vs 2019 + qt 5.12
创建dll
上一次我们是直接使用的qt 为我们提供方便的类库创建 ,这次呢 我们自己写类库
第一步:创建一个QT应用程序

第二步,修改程序为 生成dll
并且 我修改了生成的所在路径
添加QT的模块 ,自己用了什么,就添加什么,对应自己的版本,我的是release
代码如下:自己手动添加了 宏
#pragma once
# if defined Widget_DLL
# define WidgetDLL_EXPORT Q_DECL_EXPORT
# else
# define WidgetDLL_EXPORT Q_DECL_IMPORT
# endif
#include <QtWidgets/QWidget>
#include "ui_WidgetDLL.h"
class WidgetDLL_EXPORT WidgetDLL : public QWidget
{
Q_OBJECT
public:
WidgetDLL(QWidget *parent = Q_NULLPTR);
private:
Ui::WidgetDLLClass ui;
};

这样我们就是一个导出类了
第三步:生成我们的界面dll
include 包含头文件 ui_xxx.h 这是我们uic 编译 所生成的文件 ,我们需要添加进来,否则会报错 ,找不到它,他在什么位置呢? 在我们的uic文件夹中 可以找到 该文件
bin中所包含的动态库 和 导入库 (这里的lib其实是导入库,不是静态库)
第四步:调用我们生成的界面dll
如何调用呢,其实和我们上一次链接的是相同的



我们需要将 界面dll 与 exe 同级
运行结果如下:
边栏推荐
- 如何保护 LDAP 目录服务中的用户安全?
- 深度学习之 12 循环神经网络RNN2
- 【PCBA方案】电子握力测试仪方案she‘ji
- 内置模板市场,DataEase开源数据可视化分析平台v1.13.0发布
- 论文解读(g-U-Nets)《Graph U-Nets》
- LeetCode每日一题(1573. Number of Ways to Split a String)
- DDL:ALTER 修改数据库——《mysql 从入门到内卷再到入土》
- 每次打开chrome会跳出What's new
- PROCEDURE :存储过程结构——《mysql 从入门到内卷再到入土》
- 【PCBA scheme design】Bluetooth skipping scheme
猜你喜欢

我的世界整合包 云服务器搭建方法(ECS)

内置模板市场,DataEase开源数据可视化分析平台v1.13.0发布

Uniapp编译后小程序的代码反编译一些思路

An article to teach you a quick start and basic explanation of Pytest, be sure to read

shell programming without interaction

FPGA - Memory Resources of 7 Series FPGA Internal Structure -03- Built-in Error Correction Function

xshell (sed command)

The use of TortoiseSVN little turtle

LeetCode-498 - Diagonal Traversal

ACM解题笔记——HDU 1401 Solitaire(DBFS)
随机推荐
力扣221题,最大正方形
ENVI最小距离、最大似然、支持向量机遥感影像分类
2022.8.8 Selected Lectures on Good Topics (Number Theory Field)
HighTec快捷键(Keys)设置位置
Exploration and practice of the "zero trust" protection and data security governance system of the ransomware virus of Meichuang Technology
Service - DNS forward and reverse domain name resolution service
[Maui official version] Create a cross-platform Maui program, as well as the implementation and demonstration of dependency injection and MVVM two-way binding
MySQL高级指令
shell(文本打印工具awk)
F. Binary String Reconstruction
UPDATE:修改数据语法使用例——《mysql 从入门到内卷再到入土》
The perfect alternative to domestic Gravatar avatars Cravatar
Alibaba and Ant Group launched OceanBase 4.0, a distributed database, with single-machine deployment performance exceeding MySQL
服务——DNS正向反向域名解析服务
Detailed explanation of the use of Oracle's windowing function (2)
C#【必备技能篇】Hex文件转bin文件的代码实现
从斐波那契 - 谈及动态规划 - 优化
Kubernetes Notes / Getting Started / Production Environment / Installing Kubernetes with Deployment Tools / Starting a Cluster with kubeadm / Creating a Cluster with kubeadm
这些不可不知的JVM知识,我都用思维导图整理好了
xshell (sed 命令)