Thread: The Dreaded "Unresolved External Symbol" :-(

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Omaha, NE
    Posts
    5

    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:

    Linking...
    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:

    Code:
        /* 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);
            exit(1);
        }
    The function pcap_findalldevs_ex being the culprit.

    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.

    Any ideas?

    cheers,
    DrMario

  2. #2
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    An unresolved external symbol usually means that you have a declaration of a class or function in an external header file, but it's never defined anywhere. It means that you have something incomplete or awry with your external header files that are to be linked to your main source file.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I'm using VC++ v6.0, and I have the WinpCap library installed in my libraries directory
    As well as saying where everything was, did you actually tell it the name of the library as well?

    In the "use additional libraries", you need the actual names of the libraries you want to link against.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Replies: 8
    Last Post: 04-27-2006, 10:39 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM
  5. Ask about these "unresolved external symbol" error
    By ooosawaddee3 in forum C++ Programming
    Replies: 1
    Last Post: 06-29-2002, 11:39 AM