LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-18-2007, 06:27 AM   #1
uma mahesh
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Rep: Reputation: 0
Error while using libpcap


I could not compile a c program that uses libpcap
#include<pcap.h>
main(int argc, char **argv){
..
..

/* Open the capture file */
if ((fp = pcap_open_offline(argv[1], errbuf)) == NULL)
..
}
when i compile
/tmp/cc9Z2hEW.o(.text+0x59): In function `main':
: undefined reference to `pcap_open_offline'
/tmp/cc9Z2hEW.o(.text+0xa0): In function `main':
: undefined reference to `pcap_loop'
/tmp/cc9Z2hEW.o(.text+0xae): In function `main':
: undefined reference to `pcap_close'
collect2: ld returned 1 exit status

libpcap was installed while installing tcpdump
 
Old 09-18-2007, 06:29 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Looks like you need to link the library. Put a -lpcap at the end of your compile command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
libpcap thealphajustin Linux - Newbie 2 09-22-2006 04:52 PM
fragrouter: libpcap error android6011 Linux - Software 0 09-18-2006 06:16 PM
error installing libpcap-0.8.3 on slackware 10 buddamonk Linux - Software 1 11-04-2004 11:46 AM
libpcap linking error Hammo Linux - Networking 5 02-20-2003 07:20 AM
libpcap oulevon Linux - General 1 09-25-2001 09:06 AM


All times are GMT -5. The time now is 05:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration