[Winpcap-users] error C2065: 'PCAP_SRC_IF_STRING' : undeclaredidentifier

Gianluca Varenni gianluca.varenni at cacetech.com
Sat Jan 14 04:19:03 GMT 2006


Craig,

you probably forgot to add WPCAP and HAVE_REMOTE in the preprocessor 
definitions for your project.

I think you are using managed C++ (the call to MessageBox::Show is to a 
managed type), in order not to have linking or runtime problems, I suggest 
you to read this message from the winpcap-users mailing list

http://www.mail-archive.com/winpcap-users@winpcap.polito.it/msg02138.html

Have a nice day
GV

----- Original Message ----- 
From: "Craig Bumpstead" <cbumpste at yahoo.com.au>
To: <winpcap-users at winpcap.org>
Sent: Friday, January 13, 2006 7:06 PM
Subject: [Winpcap-users] error C2065: 'PCAP_SRC_IF_STRING' : 
undeclaredidentifier


Hi,

I have the following error:
error C2065: 'PCAP_SRC_IF_STRING' : undeclared
identifier

Thank you to Gianluca Varenni for his suggestion, but
I think I should stay with VC++ 2003 as most seem to
use it rather than 2005.

The code is the sample from the doc's, just modified
slightly.
I have put the relevant paths to the includes and lib
directories in VC++ and included pcap.h in form1.h.
What am I missing?
I have put the following code in the form_load area.


#undef MessageBox

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_ex(PCAP_SRC_IF_STRING, NULL
/* auth is not needed */, &alldevs, errbuf) == -1)
    {
MessageBox::Show(S"Error in pcap_findalldevs_ex");
        //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);
++i;
        if (d->description)
{
String *myString;
myString = d->description;
cboListInterfaces->Items->Add(myString);
/*printf(" (%s)\n", d->description);*/
}
        else
{
            /*printf(" (No description
available)\n");*/
MessageBox::Show(S"No description
available",S"Error");
}
    }

    if (i == 0)
    {
MessageBox::Show(S"No interfaces found! Make sure
WinPcap is installed.",S"Error");
        //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);
}




Cheers,
Craig




____________________________________________________
Do you Yahoo!?
Listen to over 20 online radio stations and watch the latest music videos on 
Yahoo! Music.
http://au.launch.yahoo.com
_______________________________________________
Winpcap-users mailing list
Winpcap-users at winpcap.org
https://www.winpcap.org/mailman/listinfo/winpcap-users



More information about the Winpcap-users mailing list