gives the errors:Code:#include <winsock.h> #include <stdio.h> #include <stdlib.h> #include <pcap.h> /* GIMME a libpcap plz! */ #include <errno.h> int main(int argc, char **argv) { char *dev; /* name of the device to use */ char *net; /* dot notation of the network address */ char *mask;/* dot notation of the network mask */ int ret; /* return code */ char errbuf[PCAP_ERRBUF_SIZE]; bpf_u_int32 netp; /* ip */ bpf_u_int32 maskp;/* subnet mask */ struct in_addr addr; /* ask pcap to find a valid device for use to sniff on */ dev = pcap_lookupdev(errbuf); /* error checking */ if(dev == NULL) { printf("%s\n",errbuf); exit(1); } /* print out device name */ printf("DEV: %s\n",dev); /* ask pcap for the network address and mask of the device */ ret = pcap_lookupnet(dev,&netp,&maskp,errbuf); if(ret == -1) { printf("%s\n",errbuf); exit(1); } /* get the network address in a human readable form */ addr.s_addr = netp; net = inet_ntoa(addr); if(net == NULL)/* thanks Scott :-P */ { perror("inet_ntoa"); exit(1); } printf("NET: %s\n",net); /* do the same as above for the device's mask */ addr.s_addr = maskp; mask = inet_ntoa(addr); if(mask == NULL) { perror("inet_ntoa"); exit(1); } printf("MASK: %s\n",mask); return 0; }
ive added all the library paths to code block compiler and linker directories evident by the fact that i dont get error while linking pcap.h.Code:obj\Debug\main.o||In function `main':| D:\tcp\tcp test\main.c|31|undefined reference to `pcap_lookupdev'| D:\tcp\tcp test\main.c|44|undefined reference to `pcap_lookupnet'| D:\tcp\tcp test\main.c|54|undefined reference to `inet_ntoa@4'| D:\tcp\tcp test\main.c|66|undefined reference to `inet_ntoa@4'| ||=== Build finished: 4 errors, 0 warnings ===|
please help, thank you.



2Likes
LinkBack URL
About LinkBacks



