Q:

How do I get the pcap lib on Ubuntu?

I have a programming assignment where I need to use the pcap lib.
#define _BSD_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pcap.h> // <-- missing include
#include <netinet/ip.h>
#include <netinet/tcp.h>

void logpacket( unsigned char* payload, struct ip* ipheader, struct tcphdr* tcpheader )
{
    //...
}

int main(int argc, char* argv[] )
{
    //...
}

How can I get the library files I need to compile this program?

A:

For Ubuntu 12.04, 12.10, 13.10, 14.04 and onward open the terminal and type:
sudo apt-get install libpcap0.8-dev  

