Question

i need to use winpcap library in my c++11/qt5 project, and just after including library i'm getting errors like on the screenshot: click.
In pro file i have

QMAKE_CXXFLAGS += -std=c++11 -lwpcap
INCLUDEPATH += D:/Qt/Pr_inz1/WpdPack/Include
LIBS += -L D:/Qt/Pr_inz1/WpdPack/Lib -lwpcap -lpacket

I'm including this library like this:

extern "C"
{
    #include <pcap.h>
    #include <winsock.h>
}

How can fix problems with

'u_int' does not name a type typedef u_int bpf_u_int32;
'bpf_u_int32' does not name a type bpf_u_int32 snaplen;

I tried add

#include <cstdint>
#include <cstdio>

but this nothing helps.

Was it helpful?

Solution

try to #include <winsock2.h> before #include <pcap.h>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top