当前位置:网站首页>QT QT 】 【 to have developed a good program for packaging into a dynamic library
QT QT 】 【 to have developed a good program for packaging into a dynamic library
2022-08-03 16:06:00 【Cappuccino-jay】
前两篇博客:
1、不带uiThe generation and invocation of the dynamic library of the interface
2、带uiThe generation and invocation of the dynamic library of the interface
If it is has developed a good project or a project,Want to encapsulate as a dynamic library,How to be faster and more convenient:
例如:QT项目工程
How to the project engineering fast packaging into dynamic library?
1、修改配置文件
#TEMPLATE = app
TEMPLATE = lib
DEFINES += RECDATA_LIBRARY

2、新建一个头文件recdata_global.h,并添加如下代码
#include <QtCore/qglobal.h>
#if defined(RECDATA_LIBRARY)
# define RECDATASHARED_EXPORT Q_DECL_EXPORT
#else
# define RECDATASHARED_EXPORT Q_DECL_IMPORT
#endif

3、引入头文件,Modify the derived class definition
#include "recdata_global.h"
class RECDATASHARED_EXPORT RecData : public QWidget

#include "recdata_global.h"
class RECDATASHARED_EXPORT showData : public QWidget

4、重新构建、运行
5、若是 MinGW32 编译器,After compiling, it will be found in the folder ***.dll 和 ***.a 文件;若是 MSVC 编译器,则应该是 ***.dll和 ***.lib .

6、调用
in programs that use the library,新建一个 include 文件夹 和 一个lib 文件夹,将 导出类的头文件 复制进include文件夹中,将编译生成的***.lib文件复制到lib文件夹中,Then import the header file into the program.
INCLUDEPATH += $$PWD/include
LIBS += -L$$PWD/lib -lRecData
在编译之后,Compile in different modesdllThe file is placed in the folder where the program is compiled,to run the program normally.
边栏推荐
- 基于DMS的数仓智能运维服务,知多少?
- Interpretation of the 2021 Cost of Data Breach Report
- Spark entry learning-2
- 开源一夏 | 阿里云物联网平台之极速体验
- [Code Hoof Set Novice Village 600 Questions] Define a function as a macro
- Taurus.MVC WebAPI 入门开发教程1:框架下载环境配置与运行(含系列目录)。
- A new round of competition for speech recognition has started. Will natural dialogue be the next commanding height?
- 5 v 8.4 v1A charging current charging management IC
- How much does Ark Survival Evolved cost?
- 一文看懂推荐系统:召回02:Swing 模型,和itemCF很相似,区别在于计算相似度的方法不一样
猜你喜欢

Yii2安装遇到Loading composer repositories with package information

神经网络,凉了?

【Unity入门计划】制作RubyAdventure01-玩家的创建&移动

上亿数据怎么玩深度分页?兼容MySQL + ES + MongoDB

Not to be ignored!Features and advantages of outdoor LED display

NodeJs - cross domain

How much does Ark Survival Evolved cost?

30W 2C(JD6606S + FP6652X2)BOM

JS基础--判断

MATLAB gcf figure save image with black background/transparent background
随机推荐
如何将二维空间先验注入到ViT中? UMA&港理工&阿里提出SP-ViT,为视觉Transformer学习2D空间先验知识!...
托尔斯泰:生活中只有两种不幸
JS基础--判断
How to get the 2 d space prior to ViT?UMA & Hong Kong institute of technology & ali SP - ViT, study for visual Transformer 2 d space prior knowledge!.
How to start an NFT collection
AI也有健忘症?英国41岁教授专访:解决灾难性遗忘
Yii2安装遇到Loading composer repositories with package information
移动应用出海,你的“网络优化”拖后腿了吗?
How to play deep paging with hundreds of millions of data?Compatible with MySQL + ES + MongoDB
LyScript 验证PE程序开启的保护
泰山OFFICE技术讲座:文字边框高度研究
Taurus.MVC WebAPI 入门开发教程1:框架下载环境配置与运行(含系列目录)。
1、实例开启无锁表结构变更以后,在任务编排中通过“单实例SQL”节点进行的结构变更,是优先采用无锁表
袁小林:沃尔沃专注于出行的安全感,并且把它做到极致
请问下,flink cdc监控oracle,我看源码是通过sid方式的,请问怎么改成service
CopyOnWriteArrayList详解
Leetcode76. 最小覆盖子串
AI+BI+可视化,Sugar BI架构深度剖析
不安装运行时运行.NET程序
2021年数据泄露成本报告解读