当前位置:网站首页>【Qt】添加第三方库的知识补充
【Qt】添加第三方库的知识补充
2022-07-01 02:51:00 【不知道在干嘛每天】
写在前面
本文将针对QT添加第三方库的过程和原理做一个知识的补充,包括静态库和动态库、MinGW和MSVC、make和makeinstall、debug和release、环境变量等。(C++中同理)
1、库
1.1、静态库
Windows :.lib
Linux\Mac:.a
静态库在编译的时候会被直接拷贝到目标程序里。
(程序打包后,放到没有环境的电脑中,也可以正常运行)
2.2、动态库
Windows :.dll
Linux:.so
Mac: dylib
动态库在编译时并不会被拷贝到目标程序中,只会在运行的时候调用。
(程序打包后,放到没有环境的电脑中,可能无法正常运行;需要把相应的dll动态库一起打包才能正常运行)
2、编译器
2.1、MSVC
MSVC是指微软的VC编译器,主要用于windows下开发。
(使用msvc导入第三方库的时候,库文件一般是.lib)
2.2 MinGW
MinGW是指是Minimalist GNU on Windows的缩写。它是一个可自由使用和自由发布的Windows特定头文件和使用GNU工具集导入库的集合,允许你 在GNU/Linux和Windows平台生成本地的Windows程序而不需要第三方运行时库。
(使用mingw导入第三方库的时候,库文件一般是.a)
3、make和make install
3.1、make
make是用来编译的,它从Makefile中读取指令,然后编译。
如果你使用静态库,只需要make即可,生成.lib或者.a。
3.2、make insatll
make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。
如果你使用动态库,需要make insatll,生成.dll或者.so。一般使用动态库在导入库之前需要配置环境变量。
4、配置环境变量
配置环境变量一般是可执行文件.exe的目录。
如果配置第三方库、则是配置动态库的目录,一般在make insatll之后生成的bin目录中,里面包含dll或.exe文件
5、在windows调用静态库
(静态库只需编译,不用make insatll)
一般先用cmake生成makefile,或者sln
5.1 MingGw
用mingw32-make编译
获取编译好的.a文件
在代码中配置.a文件和头文件(include)
5.2 MSVC
打开camke生成的sln(用vs2019)
选择Debug或者Release,x86\x64
选择ALL_BUILD, 右击, 重新生成
获取输出的.lib文件,区分debug和release
在代码中配置.lib文件和头文件(include)
6、在windows调用动态库
(动态库需要make insatll)
一般先用cmake生成makefile,或者sln
5.1 MingGw
用mingw32-make编译
然后再mingw32-make install
在输出的目录中一般有一个bin目录,里面有dll或exe
将这个bin目录的路径添加到环境变量
获取编译好的.a文件(一般在lib目录下)
在代码中配置.a文件和头文件(include)
5.2 MSVC
待补充…
7、在VS2019中添加第三方库
一般动态库这样配置

静态库这样配置


边栏推荐
- 【机器学习】向量化计算 -- 机器学习路上必经路
- 7_OpenResty安装
- Mouse over effect 8
- I want to know how to open a stock account? Is it safe to open an account online?
- Nacos configuration center tutorial
- Mouse over effect II
- Const and the secret of pointers
- 如果在小券商办理网上开户安全吗?我的资金会不会不安全?
- pycharm 软件deployment 灰色 无法点
- [PR # 5 A] two way running (state pressure DP)
猜你喜欢

单片机 MCU 固件打包脚本软件

UE4 rendering pipeline learning notes

Dell server restart Idrac method

Restcloud ETL data realizes incremental data synchronization through timestamp

【小程序项目开发 -- 京东商城】uni-app 商品分类页面(上)

servlet【初识】

Visual effects, picture to cartoon function

Optimal Transport系列1

Introduction to kubernetes resource objects and common commands (II)

Restcloud ETL WebService data synchronization to local
随机推荐
Restcloud ETL practice to realize incremental data synchronization without identification bit
VirtualBox installation enhancements
记一次服务部署失败问题排查
鼠标悬停效果十
Record a service deployment failure troubleshooting
Pulsar的Proxy支持和SNI路由
联想X86服务器重启管理控制器(XClarity Controller)或TSM的方法
js中的图片预加载
Sampling Area Lights
Restcloud ETL WebService data synchronization to local
如果我在北京,到哪里开户比较好?另外,手机开户安全么?
In the industrial Internet, "small" programs have "big" effects
Dell server restart Idrac method
Mouse over effect VI
Complete training and verification of a neural network based on pytorch
MnasNet学习笔记
ipmitool下载地址和编译安装时可能出现的问题
Ipmitool download address and possible problems during compilation and installation
园区运营效率提升,小程序容器技术加速应用平台化管理
[PR # 5 A] two way running (state pressure DP)