当前位置:网站首页>【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中添加第三方库
一般动态库这样配置

静态库这样配置


边栏推荐
- 鼠标悬停效果五
- Use ipmitool to configure BMC network and user information of X86 server
- ssh配置免密登录时报错:/usr/bin/ssh-copy-id: ERROR: No identities found 解决方法
- SAP ALV summary is inconsistent with exported excel summary data
- js中的原型和原型链
- 【机器学习】向量化计算 -- 机器学习路上必经路
- Mouse over effect VI
- 鼠标悬停效果一
- LeetCode_栈_困难_227.基本计算器(不含乘除)
- JS anti shake and throttling
猜你喜欢

Applet custom top navigation bar, uni app wechat applet custom top navigation bar

Visual effects, picture to cartoon function

Restcloud ETL practice data row column conversion

Go import self built package
![[2022] Jiangxi postgraduate mathematical modeling scheme and code](/img/f4/86b0dc2bd49c3a54c1e0538b31d458.png)
[2022] Jiangxi postgraduate mathematical modeling scheme and code

【小程序项目开发-- 京东商城】uni-app之分类导航区域

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

Detailed data governance knowledge system

视觉特效,图片转成漫画功能

Complete training and verification of a neural network based on pytorch
随机推荐
Nacos configuration center tutorial
Share Creators萌芽人才培养计划来了!
在unity中使用jieba分词的方法
Add / delete / modify query summary insert/create/put/add/save/post, delete/drop/remove, update/modify/change, select/get/list/find
Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip
How to open a stock account? Also, is it safe to open an account online?
js中的原型和原型链
Mouse over effect IV
鼠标悬停效果三
A shooting training method based on the digital measurement of Joule energy and posture of sphygmomanometer air bag with standard air pressure
LeetCode_栈_困难_227.基本计算器(不含乘除)
ipmitool下载地址和编译安装时可能出现的问题
Complete training and verification of a neural network based on pytorch
Proxy support and SNI routing of pulsar
RestCloud ETL实践之无标识位实现增量数据同步
I want to know how to open a stock account? Is it safe to open an account online?
使用ipmitool配置X86服务器的BMC网络和用户信息
The operation efficiency of the park is improved, and the application platform management of applet container technology is accelerated
【微信小程序開發】樣式匯總
[PR # 5 A] two way running (state pressure DP)