Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Using pcap.h

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
ishamael
Posts: 8
Joined: 2007-09-29 05:19

Using pcap.h

#1 Post by ishamael »

Hi! I'm new to Linux, and am mainly using it for programming and networking. I've just started with programming on linux(have done a fair bit on windows already). I'm trying to use pcap.h, but unfortunately the compiler always reports an error for this.
For example, if i type

Code: Select all

#include<iostream.h>
#include<pcap.h>

int main()
{           printf("Hello world");
             return 0;
}
I save this as hello.c

Then I go to the terminal, and i type

g++ /.../...../.../hello.c (This is the address where the program is stored)

Here it gives an error saying cant find pcap.h

I'm using Debian 4.0. I've installed all the libpcap apckages I could find using the Synaptic package manager.

Please forgive me if my queries are a little too basic, I've just started on linux.
I searched the forum for pcap.h, but couldnt find anything useful

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#2 Post by Lavene »

Just a shot in the dark:

Code: Select all

apt-get install libpcap-dev

ishamael
Posts: 8
Joined: 2007-09-29 05:19

#3 Post by ishamael »

A shot in the dark seems to be pretty accurate :) , but still not complete. Apparently, it couldnt find the libpcap-dev pakage. So how can I get it now? And shouldnt it be on one of the CD's? The exact o/p was

Reading Package List...Done
Building deendency tree...done
E: Couldnt find packae libpcap-dev

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#4 Post by Lavene »

As far as I know the -dev packages is not on the CDs but it *is* in the repositories:

Code: Select all

apt-cache policy libpcap-dev
libpcap-dev:
  Installed: (none)
  Candidate: 0.9.7-1
  Version table:
     0.9.8-1 0
        500 ftp://ftp.no.debian.org unstable/main Packages
     0.9.7-1 0
        990 ftp://ftp.no.debian.org testing/main Packages
     0.7.2-7 0
        500 ftp://ftp.no.debian.org etch/main Packages
So next question is: What's in your /etc/apt/sources.list?

ishamael
Posts: 8
Joined: 2007-09-29 05:19

#5 Post by ishamael »

Hmmm....when I type apt-cache polcy libpcap-dev, I get

W: Unable to locate package libpcap-dev (Not surprising, I guess)

As for etc/apt/sources.list, I'll try and post an image as soon as possible(dont have a pendrive at the moment, and I'm using net on windows). But as far as i remember, it gave some statements saying it's trying to connect to the net(some specific site on Debian), but couldnt.

ishamael
Posts: 8
Joined: 2007-09-29 05:19

#6 Post by ishamael »

Really sorry took so long posting the rest of the information, just got bogged down by work.

My sources.list gives:

#
#deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386DVD Binary-1 20070407-11:40]/ etch contrib main

deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386DVD Binary-1 20070407-11:40]/ etch contrib main

# Line commented out by installer because it failed to verify:
#deb http://security.debian.org/ etch/updates main contrib
# Line commented out by installer because it failed to verify
#deb-src http://security.debian.org/ etch/updates main contrib


I'm guessing that this means its trying to connect to the net, but cant. Actually, thats one of the problems I have, since I need a specific client to use the net, and I only have a windows one at the moment. I've spoken to my ISP, and it should be resolved soon. So, in the meantime, is it possible to check the information from somewhere else?

And thanks for all the help so far :)

timberwolf
Posts: 55
Joined: 2007-08-08 18:36
Location: Hampshire, England

#7 Post by timberwolf »

Go to the Debian home page, look for the link Packages http://www.debian.org/distrib/packages, then search for the packages that you are interested in, and download them using your web browser. Transfer the .deb packages to your internet lacking debian computer, and use 'dpkg -i foo.deb', and you'll have to handle any package dependencies yourself.

The libpcap-dev package is also available on the 2nd DVD, not sure why the moderator claimed it wasn't. There are three DVDs for Etch, in theory the most used packages are contained on the first DVD. BTW there is a Windows version of Jigdo, so you can download the DVD iso images in a vaguely friendly way...
Jules

ishamael
Posts: 8
Joined: 2007-09-29 05:19

#8 Post by ishamael »

timberwolf wrote:Go to the Debian home page, look for the link Packages http://www.debian.org/distrib/packages, then search for the packages that you are interested in, and download them using your web browser. Transfer the .deb packages to your internet lacking debian computer, and use 'dpkg -i foo.deb', and you'll have to handle any package dependencies yourself.
Hey, thanks a lot! I downloaded a package from there( cant remember the exact name right now, but it was for i386). Ran into a few glitches while installing it, so I finally just extracted the required header files from there into the required directory. It seems to be running fine now, judging by the fact that hello world and other simple programs are getting compiled with this header file included. :)
timberwolf wrote: The libpcap-dev package is also available on the 2nd DVD, not sure why the moderator claimed it wasn't. There are three DVDs for Etch, in theory the most used packages are contained on the first DVD. BTW there is a Windows version of Jigdo, so you can download the DVD iso images in a vaguely friendly way...
Umm...are you sure? Coz as I already mentioned, when I search for it, it doesnt show any results on the Synaptic package Manager.

timberwolf
Posts: 55
Joined: 2007-08-08 18:36
Location: Hampshire, England

#9 Post by timberwolf »

Yes, libpcap*-dev packages are on DVD Binary-2 for 4.0 r1. I can't be certain on what disc that will be on for 4.0 r0 (packages aren't guaranteed to be on the same disc between releases).

Your sources.list that you posted earlier, if it was the complete file, doesn't contain sources for either 2nd or 3rd DVDs. If you have downloaded and burnt all 3 DVDs, then you need to use apt-cdrom to add the other discs. I don't use Synaptics, so there may be another way to add the discs.
Jules

Post Reply