tcpdump mailing list archives

about "can't compile with #include<pcap.h>"


From: Alexander Shneider AKA nCryer <shurik () 062 com ua>
Date: Wed, 23 Apr 2003 19:59:22 +0300

Sorry for my english.
about problem described in:
http://www.tcpdump.org/lists/workers/2002/03/msg00105.html
If  this problem not solved yet. I using libpcap 0.7.1 on linux 2.4.20

I have same trouble when I try to link module using pcap with my c++ modules.
I can propose you next way to fix it (it's way I do)

in  pcap. h  replace #include <net/bpf.h>
with:

#ifdef __cplusplus
#include <bpf_cxx.h>
#endif
#ifndef __cplusplus
#include <net/bpf.h>
#endif

and add file bpf_cxx.h :

/*start of bpf_cxx.h*/
extern "C"
{
#include <net/bpf.h>
}
/*end of bpf_cxx.h*/

In this way my test program work if I compiled it as C program and if I 
compiled it as C++ program and no need to modify net/bpf.h

Please, let me know can it help you or not.
-- 
have a nice day
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: