pcap_findalldevs_ex Funktion nicht definiert ist

Ich versuche ein Beispiel für den Erhalt erweiterte Informationen über installierte n/w-Geräte von WinPcap.

Habe ich selbst folgte den Anweisungen, einschließlich WinPcap Bibliothek ,noch der compiler beschwert sich, dass pcap_findalldevs_ex undefined

in Zeile if (pcap_findalldevs_ex(source, NULL, &alldevs, errbuf) == -1).

Mein Code :

#include "stdafx.h"
#include <stdio.h>
#include "pcap.h"
#include <winsock2.h>
#pragma comment(lib, "ws2_32")

//Function prototypes
void ifprint(pcap_if_t *d);
char *iptos(u_long in);
char* ip6tos(struct sockaddr *sockaddr, char *address, int addrlen);



int _tmain(int argc, _TCHAR* argv[])
{
    pcap_if_t *alldevs;
    pcap_if_t *d;
    char errbuf[PCAP_ERRBUF_SIZE+1];
    char source[PCAP_ERRBUF_SIZE+1];

    printf("Enter the device you want to list:\n"
        "rpcap://             ==> lists interfaces in the local machine\n"
        "rpcap://hostname:port ==> lists interfaces in a remote machine\n"
        "                          (rpcapd daemon must be up and running\n"
        "                           and it must accept 'null' authentication)\n"
        "file://foldername     ==> lists all pcap files in the give folder\n\n"
        "Enter your choice: ");

    fgets(source, PCAP_ERRBUF_SIZE, stdin);
    source[PCAP_ERRBUF_SIZE] = '\0';

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

    /* Scan the list printing every entry */
    for(d=alldevs;d;d=d->next)
    {
        ifprint(d);
    }

    pcap_freealldevs(alldevs);

    return 1;

    return 0;
}

/* Print all the available information on the given interface */
void ifprint(pcap_if_t *d)
{
    //Code removed to reduce length and it contains no errors.
}



/* From tcptraceroute, convert a numeric IP address to a string */
#define IPTOSBUFFERS    12
char *iptos(u_long in)
{
    //Code removed to reduce length
}

char* ip6tos(struct sockaddr *sockaddr, char *address, int addrlen)
{
        //Code removed to reduce length
}

Kann jemand mich in die richtige Richtung?

Edit : Wenn ich pcap_findalldevs(&alldevs, errbuf) im obigen code erfolgreich erstellt. Also ich denke, es ist kein problem, die Verknüpfung zu der dll.

Edit 1 : Fehler

error C3861: 'pcap_findalldevs_ex': Bezeichner wurde nicht gefunden

IntelliSense:identifier "pcap_findalldevs_ex" undefined

Dank.

  • Gleiche Antwort für mich gearbeitet, und ich hatte zum Verweis auf 32-bit-Bibliotheken statt x64 eine (WpdPack\Lib\x64), obwohl mein 64-bit OS
InformationsquelleAutor Searock | 2011-03-10
Schreibe einen Kommentar