We're now a non-profit! Support open source packet analysis by making a donation.

Wireshark-users: Re: [Wireshark-users] Configure libpcap

From: Goran Štrok <goran.strok@xxxxxxxxx>
Date: Mon, 23 Apr 2007 12:08:07 +0200
Title: Re: [Wireshark-users] Configure libpcap

For start I just want to compile simple program, where I get the device name. I have tried to compile with gcc and get this error:
undefined reference to:`pcap_lookupdev´

and with Microsoft Visual C++ 6.0, get the error:
1.obj : error LNK2001: unresolved external symbol _pcap_lookupdev
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

1.exe - 2 error(s), 0 warning(s)

Here is code:

#include <stdio.h>
#include <pcap.h>

int main(int argc, char *argv[])
        char *dev, errbuf[PCAP_ERRBUF_SIZE];
        dev = pcap_lookupdev(errbuf);
        if (dev == NULL) {
        fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
        printf("Device: %s\n", dev);

WinPcap 4.0 is instaled (but I think not propery). There are no libs but only two of files (rpcapd and Uninstall) in folder: /Program Files/WinPcap. Is this wrong? And how to get .dll or .so files?