tcpdump mailing list archives

Re: a problem in code... please help


From: Guy Harris <guy () alum mit edu>
Date: Sun, 6 Sep 2009 09:58:38 -0700


On Sep 6, 2009, at 5:46 AM, Drona Nagarajan wrote:

the file is saved as sniff.c
now on the terminal when i gcc the code i get

the problem....

/tmp/ccGTnIuI.o: In function `main':
sniff.c:(.text+0x107): undefined reference to `pcap_lookupdev'
sniff.c:(.text+0x160): undefined reference to `pcap_open_live'
sniff.c:(.text+0x1c6): undefined reference to `pcap_loop'
collect2: ld returned 1 exit status

So you're compiling it with

        gcc -o sniff sniff.c -lpcap

right? If "-lpcap" isn't there, it won't work - libpcap is a library of its own, so you have to tell the compiler to link with it.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: