Hi guys
I am using VC++ on windows xp. When I compile the following code no errors; no warning; well but when I run it there are three errors code:

void main()
{
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
char errbuf[PCAP_ERRBUF_SIZE];


/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&alldevs, errbuf) == -1)
{
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
exit(1);
}


/* Print the list */
for(d= alldevs; d != NULL; d= d->next)
{
printf("%d. %s", ++i, d->name);
if (d->description)
printf(" (%s)\n", d->description);
else
printf(" (No description available)\n");
}


if (i == 0)
{
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
return;
}    /* We don't need any more the device list. Free it */
pcap_freealldevs(alldevs);}when I try to build its executable file the following errors were generated:--------------------Configuration: test1 - Win32 Debug--------------------
Compiling...
test1.cpp
Linking...
test1.obj : error LNK2001: unresolved external symbol _pcap_freealldevs
test1.obj : error LNK2001: unresolved external symbol _pcap_findalldevs
Debug/test1.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.test1.exe - 3 error(s), 0 warning(s)

What should I do with this?Thanks in advance

add #pragma comment(lib, "wpcap.lib") or #pragma comment(lib, "winpcap.lib")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.