当前位置:网站首页>[QT] unable to open the containing file pcap.h (C1083) in QT creator
[QT] unable to open the containing file pcap.h (C1083) in QT creator
2022-07-27 07:38:00 【Cappuccino-jay】
Problem description :
When I try to winpcap Link to my QT In the creator project
Then introduce the #include <pcap.h> when , The code assistant will automatically fill
But when compiling, you get :
Error:C1083: Cannot open include file: 'pcap.h': No such file or directory
resolvent :
stay C Create a new WpdPack Folder , And then Include and Lib Copy two folders into this folder .
In the project file .pro Add the following :
INCLUDEPATH += C:/WpdPack/Include
LIBS += C:/WpdPack/Lib/wpcap.lib
LIBS += C:/WpdPack/Lib/Packet.lib
CONFIG += no_lflags_merge
explain : Here the location of the folder can be freely selected , As long as the file path in the project file is consistent
Kit Download
1、 WinPcap Program , Install after decompression .
2、 WpdPack tool kit , After decompression, the folder contains Include and Lib Two subfolders .
Test code :
#include <QCoreApplication>
#include <QDebug>
#define HAVE_REMOTE
#include <pcap.h>
#include <remote-ext.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
pcap_if_t *alldevs;
char errbuf[PCAP_ERRBUF_SIZE];
/* Retrieve the device list from the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */,
&alldevs, errbuf) == -1) {
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\\n", errbuf);
exit(1);
}
/* Print the list */
pcap_if_t *d;
int i=0;
for(d= alldevs; d != NULL; d= d->next) {
printf("%d. %s", ++i, d->name);
if (d->description) {
printf(" (%s)\\n", d->description);
} else {
printf(" (No description available)\\n");
}
}
if (i == 0) {
printf("\\nNo interfaces found! Make sure WinPcap is installed.\\n");
} else {
/* We don‘t need any more the device list. Free it */
pcap_freealldevs(alldevs);
}
return a.exec();
}
边栏推荐
猜你喜欢

Panabit SNMP配置

Prior Attention Enhanced Convolutional Neural Network Based Automatic Segmentation of Organs at Risk

Am I delayed by the code... Unfortunately, I became a programmer

Gossip: Recently, many friends talk about going abroad

(2022杭电多校三)1009.Package Delivery(贪心)

flink1.14 sql基础语法(一) flink sql表查询详解

C language implementation of guessing numbers Games project practice (based on srand function, rand function, switch statement, while loop, if condition criterion, etc.)
![Error when connecting to MySQL: public key retrieval is not allowed [solution]](/img/b3/41523d44924ec203e40453bace6627.png)
Error when connecting to MySQL: public key retrieval is not allowed [solution]

Okaleido生态核心权益OKA,尽在聚变Mining模式

vlan间路由(讲解+验证)
随机推荐
海康h9摄像头用xshell无法连接(没有启用ssh)
Synchronized lock
flink1.14 sql基础语法(一) flink sql表查询详解
C language pthread_ cleanup_ Push() and pthread_ cleanup_ Pop() function (used for the resource cleaning task after the termination action in the critical resource program segment to avoid deadlock. T
SQLite common function integration
C language implementation of guessing numbers Games project practice (based on srand function, rand function, switch statement, while loop, if condition criterion, etc.)
Using soci to connect Oracle with PostgreSQL and SQLite on rhel8
Use the PIP command to switch between different mirror sources
Zabbix: map collected values to readable statements
STM32_找到导致进入HardFault_Handler的函数
网络入门——vlan及trunk概述
Compiling and using log4cxx in rhel7.3
小程序支付管理-新版支付对接流程
Chapter 6 Shell Logic and Arithmetic
Properties类和properties配置文件的理解学习
Guava的基础功能与集合
Multithreading [preliminary - Part 1]
Docker install MySQL 8.0.28
glGetUniformLocation,glUniform4f
Cadence(十一)丝印调整和后续事项