pcap.h header file problem
Asked Answered
F

6

48

anyone know how to fix the problem regarding header file in ubuntu 10.10. I am executing a sniffing program which makes use of this header file. My system shows libcap package is installed. Still, on compiling the code, an error is coming which reads:

fatal error: pcap.h: No such file or directory compilation terminated.

Please help me out.

Thanks all:)

Foible answered 25/4, 2011 at 15:8 Comment(0)
F
69

The system won't let me correct Eric Fossum's comment, because I lack reputation. There is a typo ("libcap" vs. "libpcap") and his suggested command should read the following:

sudo apt-get install libpcap-dev
Florist answered 22/8, 2014 at 9:31 Comment(2)
I tried this, still its giving me error fatal error: libpcap/pcap.h: No such file or directory. #include <libpcap/pcap.h>Vezza
I think you should include it like this: #include <pcap.h>Florist
T
53
sudo apt-get install libpcap0.8-dev
Thiazole answered 25/4, 2011 at 15:12 Comment(3)
or try sudo apt-get install libcap-dev to better suite your OS's update systemTrigonous
Actually, the original answer is 'correct'. Out the box you may be wanting to install something and just get it to work. If you run sudo apt-get install libpcap0.8-dev then you are good to go, if you don't get the 0.8 bit in there then you'll still be hunting around for where the pcap.h file is and trying to put it into a path somehow.Fridlund
@EricFossum just for the record - you probably ment libpcap-dev, you have a typo. So I'm leaving this comment to prevent others from dumb cccv like I didHybris
M
4

If you are using yum, then

sudo yum install install libpcap-devel
Manhood answered 20/4, 2020 at 10:6 Comment(0)
S
3

You don't have the pcap.h file in your include path. You need to add the location of pcap.h to your include path when compiling:

-I/path/to/pcap.h

Sabbat answered 25/4, 2011 at 15:12 Comment(0)
P
3

If you're using linuxbrew, you can just brew install libpcap. In my case I was trying to install nethogs and it failed with this error.

Pork answered 3/1, 2019 at 22:20 Comment(0)
E
1

First install libpcap:

sudo apt-get install libpcap0.8-dev

then create its shortcut for header file:

ln -s /usr/include/pcap/bpf.h /usr/include/net/bpf.h
Enmity answered 13/5, 2021 at 23:49 Comment(2)
Shouldn't that link have been done automatically?Matthus
as usual 'yes' but maybe the make script was not configured well then, some conflicts will be happened...Enmity

© 2022 - 2024 — McMap. All rights reserved.