0

I'm struggling with winpcap in my project. I'm using Eclipse with CDT plugin.. I've installed WinPcap on my PC and included libpcap into my project. But whenever I want to build the project following error message is thrown:

C:\Users\User\Downloads\libpcap-1.6.1/pcap/pcap.h:449:1: error: 'Adapter' does not name a type
 Adapter *pcap_get_adapter(pcap_t *p);

Any idea how to solve this?

regards

user2224350
  • 2,262
  • 5
  • 28
  • 54

2 Answers2

1

Did you build and install libpcap before you are trying to run this? Simply pointing at the extracted libpcap directory will not get it to work. Read the README.Win32 file in the directory where you extracted libpcap which tells you how to build it, or alternatively, you should just use the latest version of the WinPcap developer package rather than going from scratch.

The error you are seeing is because it's not processing the line #include <pcap-stdinc.h> which needs to be included on the WIN32 platform. The C preprocessor variable WIN32 needs to be defined to include that file (at least).

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
0

You have, in effect, two different versions of *pcap that you're using - the libpcap 1.6.1 whose source you downloaded, and the WinPcap that you installed.

That won't work. Currently, if you are building for Windows, you need to use WinPcap; the libpcap source includes some of WinPcap (pcap-win32.c), but not all of it.

I would suggest that you follow Petesh's alternate solution, namely "just use the latest version of the WinPcap developer package rather than going from scratch". That means you're only going to be able to use those libpcap APIs that were in the version of libpcap upon which that version of WinPcap is based, namely 1.0.0.