当前位置:网站首页>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 modesdll
The file is placed in the folder where the program is compiled,to run the program normally.
边栏推荐
猜你喜欢
一文看懂推荐系统:召回02:Swing 模型,和itemCF很相似,区别在于计算相似度的方法不一样
MATLAB gcf图窗保存图像,黑色背景/透明背景
劲爆!协程终于来了!线程即将是过去式
方舟开服工具、服务器教程win
ReentrantLock详解
全新探险者以40万的产品击穿豪华SUV价格壁垒
如何将二维空间先验注入到ViT中? UMA&港理工&阿里提出SP-ViT,为视觉Transformer学习2D空间先验知识!...
Not to be ignored!Features and advantages of outdoor LED display
高压直流输电(HVDC)的最优潮流(OPF)(Matlab代码实现)
【深度学习】今日bug(8月2)
随机推荐
After the cnpm installation is successful, the prompt is not an internal and external command, nor is it a runnable command solution
JS基础--判断
How to prevent hacking Windows server security Settings
No inner demons, to dry!SQL optimization and diagnosis
posgresql 到 es 报这个错误 ,啥意思
【Unity入门计划】基本概念(8)-瓦片地图 TileMap 01
无内鬼,来点干货!SQL优化和诊断
上亿数据怎么玩深度分页?兼容MySQL + ES + MongoDB
CS免杀姿势
泰山OFFICE技术讲座:段落边框的绘制难点在哪里?
Convex Optimization of Optimal Power Flow (OPF) in Microgrids and DC Grids (Matlab Code Implementation)
mysql delete 执行报错:You can‘t specify target table ‘doctor_info‘ for update in FROM clause
托尔斯泰:生活中只有两种不幸
一个文件管理系统的软硬件配置清单
CopyOnWriteArrayList详解
STM32的HAL和LL库区别和性能对比
基于DMS的数仓智能运维服务,知多少?
如何将二维空间先验注入到ViT中? UMA&港理工&阿里提出SP-ViT,为视觉Transformer学习2D空间先验知识!...
MATLAB gcf figure save image with black background/transparent background
6000 字+,帮你搞懂互联网架构演变历程!