The Dreaded "Unresolved External Symbol" :-(
I was walking myself through an online tutorial on how to use the WinpCap library, and downloaded the first sample code sniplet. I compiled and that worked out fine, but when I tried to build I'm getting the following error:
main.obj : error LNK2001: unresolved external symbol "int __cdecl pcap_findalldevs_ex(char *,struct pcap_rmtauth *,struct pcap_if * *,char *)" (?pcap_findalldevs_ex@@YAHPADPAUpcap_rmtauth@@PAPA Upcap_if@@0@Z)
Debug/Get Adapter list.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
I'm guessing this is coming from this first few lines in the sample program:
The function pcap_findalldevs_ex being the culprit.
/* Retrieve the device list from the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &alldevs, errbuf) == -1)
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
I'm using VC++ v6.0, and I have the WinpCap library installed in my libraries directory, as well as having it included in my project settings. Under the options menu in VC++ I've included all the proper directories pointing to the header & source files that came with the WinpCap source download.
I even went so far as to look up the function pcap_findalldevs_ex in the online documention for WinpCap library, and found out in which header file it'ss defined, as well as in which .c file it's implemented. Both of these files are in my include & source directories.
So, VC++ is complaining about an unresolved external symbol, basically telling me "your function implentation doesn't exist", when I know damn well that it DOES exist, because I've seen it.