当前位置:网站首页>【QT】无法在QT创建者中打开包含文件pcap.h(C1083)
【QT】无法在QT创建者中打开包含文件pcap.h(C1083)
2022-07-27 06:04:00 【Cappuccino-jay】
问题描述:
当我尝试将winpcap链接到我的QT创建者项目中
然后引入#include <pcap.h>时,代码助手会自动填充
但在编译时却得到:
Error:C1083: Cannot open include file: 'pcap.h': No such file or directory
解决方法:
在 C 盘下新建一个 WpdPack文件夹,然后将 Include 和 Lib 两个文件夹拷贝到该文件夹中。
在项目文件 .pro 添加以下内容:
INCLUDEPATH += C:/WpdPack/Include
LIBS += C:/WpdPack/Lib/wpcap.lib
LIBS += C:/WpdPack/Lib/Packet.lib
CONFIG += no_lflags_merge
说明:这里文件夹的位置可自由选定,只要项目文件中的文件路径保持一致即可
工具包下载
1、 WinPcap 程序,解压后安装。
2、 WpdPack 工具包,解压后文件夹下包含有 Include 和 Lib 两个子文件夹。
测试代码:
#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();
}
边栏推荐
- DNA modified near infrared two region GaAs quantum dots | GaAs DNA QDs | DNA modified GaAs quantum dots
- 【Latex格式】双栏双图左右并排有小标题、上下并列有小标题
- Neural network parameter initialization
- 2022 0726 顾宇佳 学习笔记
- 强网杯2021 pwn 赛题解析——babypwn
- 如何借助自动化工具落地DevOps|含低代码与DevOps应用实践
- Interpretation of deepsort source code (I)
- Golang controls the number of goroutines and obtains processing results
- Drools(5):Drools基础语法(3)
- Drools(5):Drools高级语法
猜你喜欢

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

DNA modified zinc oxide | DNA modified gold nanoparticles | DNA coupled modified carbon nanomaterials

指令集董事长潘爱民出席2022 ECUG Con,为中国技术力量发声

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

(转帖)eureka、consul、nacos的对比2

Digital image processing -- Chapter 3 gray scale transformation and spatial filtering

How to implement Devops with automation tools | including low code and Devops application practice

ZnS DNA QDs near infrared zinc sulfide ZnS quantum dots modified deoxyribonucleic acid dna|dna modified ZnS quantum dots

Student status management system based on SSM

Analysis of online and offline integration mode of o2o E-commerce
随机推荐
Leetcode series (I): buying and selling stocks
Interpretation of deepsort source code (VII)
网易云信亮相 GIAC 全球互联网架构大会,解密新一代音视频架构在元宇宙场景的实践...
“蔚来杯“2022牛客暑期多校训练营1
(转帖)eureka、consul、nacos的对比1
Interpretation of deepsort source code (V)
Codeforces Round #809 (Div. 2)(6/6)(Kruskal重构树)
MySQL index failure and solution practice
Qi Yue: thiol modified oligodna | DNA modified cdte/cds core-shell quantum dots | DNA coupled indium arsenide InAs quantum dots InAs DNA QDs
Interpretation of deepsort source code (I)
Firefox browser, when accessing Tencent cloud server, failed to establish a secure connection.
Vscode creates golang development environment and debug unit test of golang
AI: play games in your spare time - earn it a small goal - [Alibaba security × ICDM 2022] large scale e-commerce map of risk commodity inspection competition
Web configuration software for industrial control is more efficient than configuration software
Gbase 8C - SQL reference 6 SQL syntax (13)
OpenGL development with QT (I) drawing plane graphics
使用pip命令切换不同的镜像源
MySQL2
flink cdc 抽取oracle的数据,会不断的占用oracle的内存吗,最后引发ora-040
R2live code learning record (3): radar feature extraction