Id like to know the process to link the Wincap library and use it in my c++ project im developing in Code Blocks.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
After struggling to do this myself I figured that I should post my solution here.
You will need to download the developer version of WinPCap and unzip it somewhere, lets say "C:\WpdPack_4_1_2".
In
Code::Blocks
, you need to add the "Include" sub directory to the search directories. To do this, go tosettings->compiler
and click on the "Search directories" tab. For the "Compiler" "Linker" and "Resource compiler" tabs you need to add the search path. Using the location above as an example, it would beC:\WpdPack_4_1_2\WpdPack\Include
.Once these have been added, click "OK" to return to the main screen.
Then, you need to add the library file to your project build settings. To do this, right click on your bolded project name on the left side and choose "Build options". Under the "Linker settings" tab add the path to the "libwpcap.a" file.
For example, it would be
C:\WpdPack_4_1_2\WpdPack\Lib\libwpcap.a
.After I did this, the example programs compiled fine. Make sure to add the
#include "pcap.h"
in your program to use the library.