I'm trying to read a pcap file in c++ (I'm using VS 2008) and I'm having the following errors:
1) error C2011: 'bpf_program' : 'struct' type redefinition.
2) error C2011: 'bpf_insn' : 'struct' type redefinition
I guess the problem is that in one file I include the Packet32.h and in another file I include pcap.h (I need Packet32.h functions in a certain class and I need pcap.h to read a pcap file in another class). I have header guards in every file.
In the main class I include both of the prementioned classes. If I switch the include order I get another error. Here's a simple code that looks like mine:
in class1.h:
.
.
.
#include <Packet32.h>
#include <windows.h>
#include <process.h>
.
.
.
in class2.h:
.
.
.
#include <pcap.h>
.
.
.
in main.cpp:
#include "stdafx.h"
#include "class1.h"
#include "class2.h"
.
.
.
I wonder if anyone could help me about this. It would be appreciated very much.