Fatal error pcap h no such file or directory

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,...

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:)

asked Apr 25, 2011 at 15:08

nwprogrammer's user avatar

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

answered Aug 22, 2014 at 9:31

famzah's user avatar

famzahfamzah

1,38017 silver badges20 bronze badges

2

sudo apt-get install libpcap0.8-dev

answered Apr 25, 2011 at 15:12

Dhaivat Pandya's user avatar

Dhaivat PandyaDhaivat Pandya

6,4794 gold badges29 silver badges42 bronze badges

3

If you are using yum, then

sudo yum install install libpcap-devel

answered Apr 20, 2020 at 10:06

jerryleooo's user avatar

jerryleooojerryleooo

81310 silver badges16 bronze badges

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

answered Apr 25, 2011 at 15:12

Tony Lukasavage's user avatar

Tony LukasavageTony Lukasavage

1,9171 gold badge14 silver badges26 bronze badges

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.

answered Jan 3, 2019 at 22:20

Fábio Santos's user avatar

Fábio SantosFábio Santos

3,7511 gold badge25 silver badges31 bronze badges

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

answered May 13, 2021 at 23:49

Eyni Kave's user avatar

Eyni KaveEyni Kave

1,01512 silver badges22 bronze badges

2

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • New to Ubuntu
  • [ubuntu] Pcap and Libpcap Installation Trouble

  1. Pcap and Libpcap Installation Trouble

    Hello everyone! I’m new and beginning to learn network protocol concepts.
    I am trying to compile a program written in C that has a pcap.h include. When I try to compile it I get the following message:

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

    I have installed libpcap0.8 using the Ubuntu Software Center, but that hasn’t worked. I also tried to download a tar.gz file from the libpcap website, but cannot copy it into the usr/include folder (if it even belongs in there, lol.)

    So what I would like is to know a simple to understand method of using pcap.h so that my program will compile correctly. Thank you!

    Last edited by dansofe0r; January 25th, 2013 at 08:31 PM.


  2. Re: Pcap and Libpcap Installation Trouble

    Quote Originally Posted by dansofe0r
    View Post

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

    I have installed libpcap0.8 using the Ubuntu Software Center, but that hasn’t worked. I also tried to download a tar.gz file from the libpcap website, but cannot copy it into the usr/include folder (if it even belongs in there, lol.)

    You need to install the development library and header files for libpcap0.8.

    Type this in terminal:

    Code:

    sudo apt-get install libpcap0.8-dev


  3. Re: Pcap and Libpcap Installation Trouble

    Thank you very much! Problem resolved.


Bookmarks

Bookmarks


Posting Permissions

  • Remove From My Forums
  • Question

  • I am programming a networking tool which uses WinPcap. I am using MS Visual Studio 2008. WinPcap is an external library which I have to use in my programme by including «pcap.h» header.

    So i inserted

    #include <pcap.h>

    into my main programme (FYP_2.cpp). I have included the external library directory in my project and i got this error:

    Error	1	fatal error C1083: Cannot open include file: 'pcap.h': No such file or directory	c:UsersUSERDocumentsVisual Studio 2008ProjectsFYP_2FYP_2FYP_2.cpp	5	FYP_2
    

    By the way, the .lib and .h files are placed in a folder.

    • Edited by

      Wednesday, November 30, 2011 7:09 AM

Answers

  • There are two requirements: the header and the lib file.

    (1) The compiler needs to know where the header is located.

    (2) The linker needs to know where the .lib file is located,
    and the lib file name.

    These need to be specified in the Project Properties.

    For (1), go to:

    Configuration Properties->C/C++->General

    and set the path for the header file in
    «Additional Include Directories»

    For (2), go to:

    Configuration Properties->Linker->General

    and set the path for the lib file in
    «Additional Library Directories»

    Also go to:

    Configuration Properties->Linker->Input

    and set the lib file name in
    «Additional Dependencies»

    If it still can’t find the header, then change:

    #include <pcap.h>

    to

    #include «pcap.h»

    — Wayne

    • Marked as answer by
      nickthx
      Wednesday, November 30, 2011 8:07 AM
    • Unmarked as answer by
      nickthx
      Wednesday, November 30, 2011 8:07 AM
    • Marked as answer by
      nickthx
      Wednesday, November 30, 2011 9:38 AM

  • As a first step, see if the project builds if you change
    the Project Property:

    Configuration Properties->General:
    «Common Language Runtime support»

    from

    Pure MSIL Common Language Runtime Support (/clr:pure)

    to

    Common Language Runtime Support (/clr)

    — Wayne

    • Marked as answer by
      nickthx
      Wednesday, November 30, 2011 9:37 AM

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error out of memory handler
  • Fatal error out of memory allocated wordpress
  • Fatal error openssl bio h no such file or directory
  • Fatal error opening dependency file dep main o d no such file or directory
  • Fatal error online session interface missing please make sure steam is running

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии