Hello bodies
I use the OS of Redhat9.0.
And now I'm trying to write a program about capture the packet in the local network. But When I wrote as follow:
...
...
int main()
{
pcap_if_t *alldevs;
pcap_if_t *d;
pcap_t *adhandle;
char errbuf[PCAP_ERRBUF_SIZE];
u_int netmask;
struct bpf_program fcode;
...
...
When I compile this program,it reported errors:
hello.c: In function `int main()':
hello.c:54: `pcap_if_t' undeclared (first use this function)
hello.c:54: (Each undeclared identifier is reported only once for each function
it appears in.)
hello.c:54: `alldevs' undeclared (first use this function)
hello.c:55: `d' undeclared (first use this function)
hello.c:59: `pcap_t' undeclared (first use this function)
hello.c:59: `adhandle' undeclared (first use this function)
hello.c:60: `PCAP_ERRBUF_SIZE' undeclared (first use this function)
hello.c:62: aggregate `bpf_program fcode' has incomplete type and cannot be
defined
hello.c:83: `errbuf' undeclared (first use this function)
hello.c:83: `pcap_findalldevs' undeclared (first use this function)
It seems that the compiler can't find the data struct "pcap_if_t",
"pcap_t"and so on. So I thought maybe I didn't setup the "Libpacp".
But I'm not sure. Didn't the Redhat setup it for me alredy?
Could anybody tell me? Thanks!