当前位置:网站首页>【QT】capture.obj:-1: error: LNK2019: 无法解析的外部符号 __imp_htons(解决方法)
【QT】capture.obj:-1: error: LNK2019: 无法解析的外部符号 __imp_htons(解决方法)
2022-07-27 06:04:00 【Cappuccino-jay】
在用QT进行套接字编程时遇到下面的错误:
1、capture.obj error: LNK2019: 无法解析的外部符号 __imp_htons,该符号在函数 “public: int __cdecl Capture::ipPackageHandle(unsigned char const *,int &)” ([email protected]@@[email protected]) 中被引用
2、capture.obj error: LNK2019: 无法解析的外部符号 __imp_ntohl,该符号在函数 “public: int __cdecl Capture::tcpPackageHandle(unsigned char const *,class QString &,int)” ([email protected]@@[email protected]@[email protected]) 中被引用
3、capture.obj error: LNK2019: 无法解析的外部符号 __imp_ntohs,该符号在函数 “public: int __cdecl Capture::ethernetPackageHandle(unsigned char const *,class QString &)” ([email protected]@@[email protected]@@Z) 中被引用
4、datapackage.obj error: LNK2019: 无法解析的外部符号 htonl,该符号在函数 “public: bool __cdecl DataPackage::getTcpOperationSACK(int,unsigned char &,class QVector &)” ([email protected]@@[email protected]@@@Z) 中被引用
5、datapackage.obj error: LNK2019: 无法解析的外部符号 inet_ntoa,该符号在函数 “public: class QString __cdecl DataPackage::getDesIpAddr(void)” ([email protected]@@[email protected]@XZ) 中被引用
6、datapackage.obj error: LNK2019: 无法解析的外部符号 ntohl,该符号在函数 “public: class QString __cdecl DataPackage::getTcpSequence(void)” ([email protected]@@[email protected]@XZ) 中被引用
7、datapackage.obj error: LNK2019: 无法解析的外部符号 ntohs,该符号在函数 “public: class QString __cdecl DataPackage::getMacType(void)” ([email protected]@@[email protected]@XZ) 中被引用
8、debug\shark.exe error: LNK1120: 7 个无法解析的外部命令

解决方法如下:
在CPP文件include语句之后加上如下代码:
#pragma comment(lib,"ws2_32.lib")
表示链接的时侯找 ws2_32.lib
然后编译就成功了:
边栏推荐
- Watermelon book learning Chapter 5 --- neural network
- MySQL query operation index optimization practice
- 基于SSM音乐网站管理系统
- 整体二分?
- Livox Slam (with lio+ closed loop detection optimization)
- Pytorch notes: td3
- 36 - 新的 Promise 方法:allSettled & any & race
- tableau prep连接maxcompute,只是书写很简单的sql,为啥报这个错误呢?
- Qi Yue: thiol modified oligodna | DNA modified cdte/cds core-shell quantum dots | DNA coupled indium arsenide InAs quantum dots InAs DNA QDs
- Visual horizontal topic bug1:filenotfounderror: could not find module 'mvcameracontrol dll‘ (or one of it
猜你喜欢

Student achievement management system based on SSM

把Excel转换成CSV/CSV UTF-8

从技术原理看元宇宙的可能性:Omniverse如何“造”火星

大疆livox定制的格式CustomMsg格式转换pointcloud2

Dajiang livox customized format custommsg format conversion pointcloud2

Campus news release management system based on SSM

Analysis of strong tennis cup 2021 PWN competition -- babypwn

Qi Yue: thiol modified oligodna | DNA modified cdte/cds core-shell quantum dots | DNA coupled indium arsenide InAs quantum dots InAs DNA QDs

MySQL2

VIVO应用市场APP上架总结
随机推荐
Peptide nucleic acid oligomer containing azobenzene monomer (nh2-tnt4, n-pnas) Qiyue biological customization
(转帖)eureka、consul、nacos的对比1
R2LIVE代码学习记录(3):对雷达特征提取
Leetcode series (I): buying and selling stocks
TS learning (VIII): classes in TS
Vscode creates golang development environment and debug unit test of golang
What is OKR and what is the difference between OKR and KPI
Automatically generate UML sequence diagram according to text (draw.io format)
泛型 -- 学会它,好处多多
Gbase 8C - SQL reference 6 SQL syntax (11)
Interpretation of deepsort source code (I)
基于SSM学生学籍管理系统
Gbase 8C - SQL reference 6 SQL syntax (15)
Codeforces Round #787 (Div. 3)(7/7)
How does golang assign values to empty structures
Cass11.0.0.4 for autocad2010-2023 dog free usage
DNA coupled PbSe quantum dots | near infrared lead selenide PbSe quantum dots modified DNA | PbSe DNA QDs
newest! SASAC releases new measures for digital transformation of state-owned enterprises
Word wrap: break word line feed is compatible with browsers
PNA modified polypeptide arms PNA PNA DNA suc aapf PNA suc - (ALA) 3 PNA