title: Pcap functions have "undefined reference"
body: <p>I'm trying to go through this tutorial:
  <a href="http://www.tcpdump.org/pcap.html" rel="noreferrer">http://www.tcpdump.org/pcap.html</a></p>
  
  <p>Now I have install pcap (code hints and all that is working) using :</p>
  
  <pre><code>sudo apt-get install libpcap-dev
  </code></pre>
  
  <p>and so far I have the following code (file name is example_pcap.c):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;pcap.h&gt;
  
  int main(int argc, char *argv[]) {
      char *dev, errbuf[PCAP_ERRBUF_SIZE];
  
      dev = pcap_lookupdev(errbuf);
  
      return 0;
  }
  </code></pre>
  
  <p>According to many questions I have seen already they said to compile it using this:</p>
  
  <pre><code>gcc -lpcap example_pcap.c -o example_pcap
  </code></pre>
  
  <p>However I still get the following error:</p>
  
  <pre><code>example_pcap.c:(.text+0x32): undefined reference to `pcap_lookupdev'
  </code></pre>