文章标题
来源:互联网 发布:sqlserver数据库安装 编辑:程序博客网 时间:2024/06/05 17:01
winpcap 4.0.2
为了跑起来刚开始的例子
include “pcap.h”
main()
{
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
char errbuf[PCAP_ERRBUF_SIZE];
/* 获取本地机器设备列表 */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);}/* 打印列表 */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"); return;}/* 不再需要设备列表了,释放它 */pcap_freealldevs(alldevs);
}
首先,既然有了#include “pcap.h” 需要设置下文件包含,方法如下:
1.菜单Tool->Options->Directories选项卡->Show directories->Include files,选择WinPcap中的开发包目录中的Include目录
2.菜单Tool->Options->Directories选项卡->Show directories->Library files,选择WinPcap中的开发包目录中的Lib目录
*3.菜单Project->Settings->Link->Objects/library modules,按End键,输入” wpcap.lib”,注意wpcap.lib 前面有空格(或#pragma comment(lib,”wpcap.lib”) )
然后,编译出错,error C2065: ‘PCAP_SRC_IF_STRING’ : undeclared identifier,解决方法如下:
pcap.h中没有此函数,是在#include
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- osx : Linking a Library to xcode
- Android回调函数理解
- Anroid之WakeLock
- 有序数组,输出和为m的所有数对(pair)
- Maven运行JUnit测试之mvn test的默认行为
- 文章标题
- ORA-28001: the password has expired
- iOS Visual format language(VFL)
- WM_QUERYENDSESSION
- android 实现侧滑菜单
- 架构整洁之道
- 余弦距离、欧氏距离和杰卡德相似性度量的对比分析
- android 的onResume方法
- 自己喜欢的句子