LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-12-2005, 09:32 PM   #1
zhuqlfeixia
LQ Newbie
 
Registered: Dec 2005
Posts: 19

Rep: Reputation: 0
Should I setup the Libpacp?


Hello bodies
I use the OS of Redhat9.0.
And now I'm trying to write a program about capture the packet in the local network. But When I wrote as follow:
...
...
int main()
{
pcap_if_t *alldevs;

pcap_if_t *d;


pcap_t *adhandle;

char errbuf[PCAP_ERRBUF_SIZE];

u_int netmask;

struct bpf_program fcode;
...
...
When I compile this program,it reported errors:

hello.c: In function `int main()':
hello.c:54: `pcap_if_t' undeclared (first use this function)
hello.c:54: (Each undeclared identifier is reported only once for each function
it appears in.)
hello.c:54: `alldevs' undeclared (first use this function)
hello.c:55: `d' undeclared (first use this function)
hello.c:59: `pcap_t' undeclared (first use this function)
hello.c:59: `adhandle' undeclared (first use this function)
hello.c:60: `PCAP_ERRBUF_SIZE' undeclared (first use this function)
hello.c:62: aggregate `bpf_program fcode' has incomplete type and cannot be
defined
hello.c:83: `errbuf' undeclared (first use this function)
hello.c:83: `pcap_findalldevs' undeclared (first use this function)

It seems that the compiler can't find the data struct "pcap_if_t",
"pcap_t"and so on. So I thought maybe I didn't setup the "Libpacp".
But I'm not sure. Didn't the Redhat setup it for me alredy?
Could anybody tell me? Thanks!
 
Old 12-12-2005, 11:24 PM   #2
primo
Member
 
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
Are you including <pcap.h> ?
 
Old 12-13-2005, 01:34 AM   #3
zhuqlfeixia
LQ Newbie
 
Registered: Dec 2005
Posts: 19

Original Poster
Rep: Reputation: 0
I setup the package of "Libpacp",and the problem has been sloved,thanks,but I still have some problems about getting the name of Network Interface Card.
I'm try to slove it . The programing under the Linux is hard. It's easy to program the same program under windows. But ,under the Linux,the programing is someting more intersting
 
  


Reply



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
NFS setup question: No password setup? ksgill Linux - General 4 12-04-2005 11:50 AM
Error Message during 802.11b setup for Intersil Card ( prism2_usb ) setup in SoC archak Linux - Wireless Networking 0 10-13-2004 03:21 AM
[SUSE 9.1 PROF] How can I copy the setup files to my harddisk and start the setup? TheRealFalcon Linux - Distributions 1 08-07-2004 11:49 PM
Need help with ethernet setup in Gentoo( During setup proccess) MimiMimi Linux - Distributions 2 07-19-2004 01:34 PM
Change 7CD setup to 1 DVD setup GaX Mandriva 1 04-22-2004 05:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:24 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration