Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4070386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:37:16+00:00 2026-05-20T16:37:16+00:00

I am trying out an example of obtaining advanced information about installed n/w devices

  • 0

I am trying out an example of obtaining advanced information about installed n/w devices from WinPcap.

I have even followed the instructions for including WinPcap library ,still the compiler complains that pcap_findalldevs_ex is undefined

at line if (pcap_findalldevs_ex(source, NULL, &alldevs, errbuf) == -1).

My 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
}

Can some one point me in the right direction?

Edit : If I use pcap_findalldevs(&alldevs, errbuf) in the above code it builds successfully. So I guess it has no problem linking to the dll.

Edit 1 : Error

error C3861: ‘pcap_findalldevs_ex’: identifier not found
IntelliSense:identifier “pcap_findalldevs_ex” is undefined

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:37:17+00:00Added an answer on May 20, 2026 at 4:37 pm

    pcap_findalldevs_ex is only present if you define HAVE_REMOTE

    Add HAVE_REMOTE as a preprocessor definition in project properties, or do the following for every include of pcap.h:

    #define HAVE_REMOTE
    #include "pcap.h"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying out an example from the book Foundations of python network programming,
Here's an example of what I'm trying to figure out. I have a couple
I'm trying to figure out how XSLT process namespace prefixes and have following example:
I am trying to work out an example from ".NET Domain Driven Design with
I'm trying out the example Hello World from this link here: http://www.mulesoft.org/documentation/display/MULE2INTRO/Quick+Start I have
I have trying out a simple example using XMLPullParser but it is throwing an
I'm using prosody XMPP server and trying out chapter 3 example from Professional XMPP
I am trying out the basic QSortFilterProxyModel example in qt assistant and have made
I was trying out a ListActivity example from the net. I am having problem
Trying out the example usage of codebrew rails-backbone , everything works fine but the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.