当前位置:网站首页>【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
然后编译就成功了:
边栏推荐
- C time related operation
- A Competitive Swarm Optimizer for Large Scale Optimization
- Watermelon book learning Chapter 5 --- neural network
- DNA modified noble metal nanoparticles | DNA modified gold nanoparticles (scientific research level)
- Golang encapsulates the packages involved in MySQL and the differences between sqlx and Gorm
- [Vani有约会]雨天的尾巴
- TS learning (VIII): classes in TS
- A Competitive Swarm Optimizer for Large Scale Optimization
- Cass11.0.0.4 for autocad2010-2023 dog free usage
- 2021 interview question of php+go for Zhongda factory (1)
猜你喜欢

Web configuration software for industrial control is more efficient than configuration software

Basic statement of MySQL (1) - add, delete, modify and query

OpenGL development with QT (I) drawing plane graphics

网易云信亮相 GIAC 全球互联网架构大会,解密新一代音视频架构在元宇宙场景的实践...

使用pip命令切换不同的镜像源

DNA (deoxyribonucleic acid) supply | carbon nanotube nucleic acid loaded dna/rna material | dna/rna nucleic acid modified magnetic nanoparticles

Cass11.0.0.4 for autocad2010-2023 dog free usage

newest! SASAC releases new measures for digital transformation of state-owned enterprises

Drools(5):Drools基础语法(3)

Student status management system based on SSM
随机推荐
Analysis of strong tennis cup 2021 PWN competition -- babypwn
The possibility of metauniverse from the perspective of technical principles: how Omniverse "built" Mars
Golang controls the number of goroutines and obtains processing results
2021 interview questions for php+go of Zhongda factory (2)
李沐动手学深度学习V2-transformer和代码实现
pre-commit install 时 CalledProcessError
Using docker to install and deploy redis on CentOS
Codeforces Round #804 (Div. 2)(5/5)
Dajiang livox customized format custommsg format conversion pointcloud2
Livox Slam (with lio+ closed loop detection optimization)
Es compares the data difference between the two indexes
DNA coupled PbSe quantum dots | near infrared lead selenide PbSe quantum dots modified DNA | PbSe DNA QDs
C4D动画如何提交云渲染农场快速渲染?
强网杯2021 pwn 赛题解析——babypwn
Instruction set x digital technology accelerates the digital transformation of government and enterprises, and builds Unicorn enterprise alliance in DT field
如何借助自动化工具落地DevOps|含低代码与DevOps应用实践
Codeforces Round #804 (Div. 2)(5/5)
Student achievement management system based on SSM
Day012 application of one-dimensional array
用typescript实现排序-递增