基于WinPcap的开发中Vs2010的配置

首先在View中选择Property Manager

然后展开工程,再展开Debug|Win32 ,接着右击 Mircrosoft.Cpp.Win32.user选择Properties(此处设置全局有效)

 

之后分三步:

 

1.       设置环境目录

VC++ Directiories Include DirectoriesLibrary Directories中添加路径。

假如将wpdpack放到c盘。则:

Include Directories:c:/wpdpack/Include;

Library Directories:c:/wpdpack/Lib;

注意分号!

 

2.       设置编译条件

C/C++Preprocessor(预处理器)的Preprocessor Definitions(预处理定义)

添加WPCAP;HAVE_REMOTE;

注意分号,每个预定义符用“;”分开。

 

3.       设置链接器

Linker(链接器)下的Input(输入)中的Additional Dependencies(附加依赖项)中添加:

wpcap.lib;ws2_32.lib;(注意分号)

 

大功告成!

 

附英文原版配置:

 

 

To create an application that uses wpcap.dll with Microsoft Visual C++, follow these steps:

  • Include the file pcap.h at the beginning of every source file that uses the functions exported by library.
  • If your program uses Win32 specific functions of WinPcap, remember to include WPCAP among the preprocessor definitions.
  • If your program uses the remote capture capabilities of WinPcap, add HAVE_REMOTE among the preprocessor definitions. Do not include remote-ext.h directly in your source files.
  • Set the options of the linker to include the wpcap.lib library file specific for your target (x86 or x64). wpcap.lib for x86 can be found in the /lib folder of the WinPcap developer's pack, wpcap.lib for x64 can be found in the /lib/x64 folder.
  • Set the options of the linker to include the winsock library file ws2_32.lib. This file is distributed with the C compiler and contains the socket functions for Windows. It is needed by some functions used by the samples in the tutorial.

How to properly set Microsoft Visual Studio

Visual Studio 6

  • To add a preprocessor definition, you must select Settings from the Project menu, then select C/C++ from the tab control, and under the category General, you must add the definition under the Preprocessor Definitions text box.
  • To add a new library to the project with Microsoft Visual C++, you must select Settings from the Project menu, then select Link from the tab control, and then add the name of the new library in the Object/library moduleseditbox.
  • To add a new path where Microsoft Visual C++ will look for the libraries, you must select Options from the Toolsmenu, then Directories from the tab control, Library files from the Show directories for combobox, and the add the path in the Directories box.
  • To add a new path where Microsoft Visual C++ will look for include files, you must select Options from the Toolsmenu, then Directories from the tab control, Include files from the Show directories for combobox, and the add the path in the Directories box.

Visual Studio 2005 (needed to compile x64 applications)

  • To add a preprocessor definition, you must select Properties from the Project menu, then select C/C++ from the list control on the left, and under the category Preprocessor, you must add the definition under the Preprocessor Definitions text box.
  • To add a new library to the project, you must select Properties from the Project menu, then select Linker from the list control on the left, and under the category Input add the name of the new library in the Additional Dependencies text box.
  • To add a new path where Microsoft Visual Studio will look for the libraries, you must select Options from theTools menu, then Project and Solutions from the list control on the left, VC++ Directories, then choose Library Filesin the Show directories for combobox, and the add the path in the box below.
  • To add a new path where Microsoft Visual Studio will look for the include files, you must select Options from theTools menu, then Project and Solutions from the list control on the left, VC++ Directories, then choose IncludeFiles in the Show directories for combobox, and the add the path in the box below. 

 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值