On Wed, Mar 27, 2002 at 02:39:00PM -0500, [EMAIL PROTECTED] wrote:
> prompt# g++ test2.cc -o test2
> In file included from test2.cc:12:
> /usr/local/include/net/bpf.h:408: previous declaration of 'u_int
> bpf_filter (bpf_insn *, u_char *, unsigned int, unsigned int)' with C++
> linkage
> /usr/local/include/pcap.h:201: conflicts with new declaration with C
> linkage
> /usr/local/include/bpf.h:407: previous declaration of 'int
>  bpf_validate (bpf_insn *, int)' with C++ linkage
> /usr/local/include/pcap.h:202: conflicts with new declaration with C
> linkage

The claims being made by G++ are all true.

The problem is that the <pcap.h> header file marks "bpf_filter()" as a C
routine, with

        extern "C" {

                ...

        }

whilst the <net/bpf.h> header file doesn't.

The only workarounds would be

        1) don't use C++

        2) put

                extern "C" {

           and

                }

           into the right places <net/bpf.h> yourself.  (See how it's
           done in <pcap.h> for an example.)

Can anybody think of a compelling reason *NOT* to put

        extern "C" {

                ...

        }

into <net/bpf.h>?  If nobody comes up with a compelling reason in the
next few days, I will add them in both the main branch and the 0.7
branch.

This will not help those OSes that distribute <net/bpf.h> themselves. 
On those OSes, installing your own libpcap might not help; you'd have to
speak to the suppliers of the OS for help.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to