Date: Thu, 9 Jul 1998 15:31:46 -0700 (PDT) From: cts@internetcds.com To: freebsd-gnats-submit@FreeBSD.ORG Subject: misc/7229: /usr/include/pcap*.h isn't C++ safe. Message-ID: <199807092231.PAA06998@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 7229 >Category: misc >Synopsis: /usr/include/pcap*.h isn't C++ safe. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Jul 9 15:40:01 PDT 1998 >Last-Modified: >Originator: Craig Spannring >Organization: InternetCDS >Release: 2.2.6 and 3.0 >Environment: FreeBSD backmaster.cdsnet.net 3.0-CURRENT FreeBSD 3.0-CURRENT #2: Tue May 5 20:30:34 PDT 1998 root@backmaster.cdsnet.net:/n/FreeBSD/3.0-back2/src/sys/compile/BACK2 i386 >Description: None of the header files for the packet capture library are suitable to include in a C++ file. They are missing the #ifdef __cplusplus extern "C" { #endif to give the declared functions C linkage >How-To-Repeat: Trying to compile this- #include <iostream.h> #include <pcap.h> main(int argc, char **argv) { pcap_t *cap = NULL; char errorBuf[4096]; cap = pcap_open_offline(argv[1], errorBuf); if (cap == NULL) { cout << "Error- " << errorBuf << endl; exit(1); } } as a C++ program will give this error- c++ tcpdump.cxx /var/tmp/ccR273601.o: Undefined symbol `_pcap_open_offline__FPcT0' referenced from text segment >Fix: Add the #ifdef __cplusplus extern "C" { #endif incantation to the begining of each of the pcap*.h files. >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807092231.PAA06998>