To create an application that useswpcap.dllwith Microsoft Visual C++, follow these steps:
Include the filepcap.hat the beginning of every source file that uses the functions exported by library.
If your program uses Win32 specific functions of WinPcap, remember to includeWPCAPamong the preprocessor definitions.
If your program uses the remote capture capabilities of WinPcap, addHAVE_REMOTEamong the preprocessor definitions. Donotinclude remote-ext.h directly in your source files.
Set the options of the linker to include thewpcap.liblibrary file specific for your target (x86 or x64).wpcap.libfor x86 can be found in the /lib folder of the WinPcap developer's pack,wpcap.libfor x64 can be found in the /lib/x64 folder.
Set the options of the linker to include the winsock library filews2_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 selectSettingsfrom theProjectmenu, then selectC/C++from the tab control, and under the categoryGeneral, 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 selectSettingsfrom theProjectmenu, then selectLinkfrom the tab control, and then add the name of the new library in theObject/library moduleseditbox.
To add a new path where Microsoft Visual C++ will look for the libraries, you must selectOptionsfrom theToolsmenu, thenDirectoriesfrom the tab control,Library filesfrom theShow directories forcombobox, and the add the path in theDirectoriesbox.
To add a new path where Microsoft Visual C++ will look for include files, you must selectOptionsfrom theToolsmenu, thenDirectoriesfrom the tab control,Include filesfrom theShow directories forcombobox, and the add the path in theDirectoriesbox.
Visual Studio 2005 (needed to compile x64 applications)
To add a preprocessor definition, you must selectPropertiesfrom theProjectmenu, then selectC/C++from the list control on the left, and under the categoryPreprocessor, you must add the definition under thePreprocessor Definitionstext box.
To add a new library to the project, you must selectPropertiesfrom theProjectmenu, then selectLinkerfrom the list control on the left, and under the categoryInputadd the name of the new library in theAdditional Dependenciestext box.
To add a new path where Microsoft Visual Studio will look for the libraries, you must selectOptionsfrom theToolsmenu, thenProject and Solutionsfrom the list control on the left,VC++ Directories, then chooseLibraryFilesin theShow directories forcombobox, 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 selectOptionsfrom theToolsmenu, thenProject and Solutionsfrom the list control on the left,VC++ Directories, then chooseIncludeFilesin theShow directories forcombobox, and the add the path in the box below.