VS2008 winpcap配置(解决fatal error C1083: Cannot open include file: 'sys/time.h'...
来源:互联网 发布:淘宝400x400logo图片 编辑:程序博客网 时间:2024/05/16 08:49
网上大多winpcap配置是关于vc6的,今天花了大半天用来配置在VS2008下的winpcap配置,我用的winpcap是4.0.2:配置过程如下:
1.安装WinPcap_4_0_2.exe,即可以抓包的驱动程序
2。下载winpcap开发包WpdPack_4_0_2.zip,里面有关开发相关的函数库以及例子
3. 打开.net平台,设置环境目录;在菜单:工具->选项;弹出的选项窗体左边点击:项目和解决方案->VC++目录;在右边:“显示以下内容的目录”标签下面的 下拉框中找到“包含文件”,然后对应到第二步下载开发包的Include目录;在同一下拉框中找到“库文件”,然后对应到第二步下载开发包的lib目录;
4. 设置编译条件;在项目属性页中:配置属性->C/C++->预处理器->预处理器定义,增加;WPCAP;HAVE_REMOTE;每 一个预定义符用";"隔开;在项目属性页中:配置属性->链接器->命令行->附加选项对应的文本框中增加:“wpcap.lib ws2_32.lib”;
5.这时运行winpcap程序会出现错误:fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
这是由于pcap.h的预编译问题造成的,打开pcap.h,可以看到开头有这几行预编译代码:
#if defined(WIN32)
#include <pcap-stdinc.h>
#elif defined(MSDOS)
#include <sys/types.h>
#include <sys/socket.h> /* u_int, u_char etc. */
#else /* UN*X */
#include <sys/types.h>
#include <sys/time.h>
#endif /* WIN32/MSDOS/UN*X */
放在Vc 6.0下就不会错,因为系统可以识别出WIN32已经定义过了,就执行了#include <pcap-stdinc.h>,但在Vs2008下,我猜测WIN32没有被预定义过,因而直接到了
#else /* UN*X */
#include <sys/types.h>
#include <sys/time.h>
代码这里,这里是Unix的库文件,当然会出现:fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory的错误提示了.
解决办法:可以把这些预编译全部注释掉,留下 #include <pcap-stdinc.h>,这样问题就可以解决了。
- VS2008 winpcap配置(解决fatal error C1083: Cannot open include file: 'sys/time.h'...
- VS 错误2 fatal error C1083: Cannot open include file: 'sys/time.h'
- fatal error C1083: Cannot open include file: 'qwtplot.h':
- fatal error C1083: Cannot open include file: 'uxtheme.h'的解决
- _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':问题的解决
- _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':问题的解决
- _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':问题的解决
- _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':问题的解决
- fatal error C1083: Cannot open include file
- fatal error C1083: Cannot open include file:
- VC++6.0编译时出现fatal error C1083: Cannot open include file: 'conio.h': No such file or directory解决
- Microsoft Visual Studio6.0\VC98\INCLUDE\userenv.h(15) : fatal error C1083: Cannot open include file:
- fatal error C1083: Cannot open include file: 'ProMenu.h': No such file or directory
- fatal error C1083 Cannot open include file 'iostream.h' No such file or directory 的解决方法
- fatal error C1083 Cannot open include file 'iostream.h' No such file or directory 的解决方法
- fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
- fatal error C1083: Cannot open include file: 'htmlhelp.h': No such file or directory 解决办法
- fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
- 维护Oracle常用SQL语句
- WinCE BSP中的Dirs文件和Sources文件
- 一个简单的WebSerivce传递图片的例子
- MMF框架学习
- 在CSDN上开博了
- VS2008 winpcap配置(解决fatal error C1083: Cannot open include file: 'sys/time.h'...
- 使用Carbide c++ 2.0在S60 Nokia 6120C上搭建真机debug调试环境的要点
- 《Microsoft Visual Studio 6.0 Enterprise Edition》(完整9CD,带中文MSDN Library)下载
- 基于VC++2010实现哈希签名与验证
- php 官网介绍
- stack around the variable "xxx"was corrupted.
- IT相关资源的网站
- AjaxSwing 3.0 发布,为 Swing 而生的 ajax
- 【代码来自EMS】最最简单的滚动条