[Winpcap-users] code::blocks ide

Jack Skraps skraps_rwt at yahoo.com
Sun Feb 1 03:18:52 GMT 2009


srry misfire, RTFM eh? x)




________________________________
From: Jack Skraps <skraps_rwt at yahoo.com>
To: winpcap-users at winpcap.org
Sent: Saturday, January 31, 2009 8:50:09 PM
Subject: [Winpcap-users] code::blocks ide


How do I use this library, Im using the code::blocks ide and have included the library in the linker and and addded a include for pcap.h but now its telling me there are errors finding the rest of the include files.

Im very new to c programming.


::code::

#include <stdio.h>
#include <stdlib.h>
#include "pcap.h"

int main()
{
    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)
    {
        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);
        if (d->description)
            printf(" (%s)\n", d->description);
        else
            printf(" (No description available)\n");
    }

    if (i == 0)
    {
        printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
        return 1;
    }

    /* We don't need any more the device list. Free it */
    pcap_freealldevs(alldevs);

    return 0;
}


::errors::
C:\cdev\winpcaptests\pcap.h|41|pcap-stdinc.h: No such file or directory|
C:\cdev\winpcaptests\pcap.h|51|pcap-bpf.h: No such file or directory|
C:\cdev\winpcaptests\pcap.h|84|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|84|warning: type defaults to `int' in declaration of `bpf_u_int32'|
C:\cdev\winpcaptests\pcap.h|84|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|127|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|127|warning: no semicolon at end of struct or union|
C:\cdev\winpcaptests\pcap.h|128|warning: type defaults to `int' in declaration of `version_major'|
C:\cdev\winpcaptests\pcap.h|128|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|129|error: syntax error before "version_minor"|
C:\cdev\winpcaptests\pcap.h|129|warning: type defaults to `int' in declaration of `version_minor'|
C:\cdev\winpcaptests\pcap.h|129|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|131|error: syntax error before "sigfigs"|
C:\cdev\winpcaptests\pcap.h|131|warning: type defaults to `int' in declaration of `sigfigs'|
C:\cdev\winpcaptests\pcap.h|131|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|132|error: syntax error before "snaplen"|
C:\cdev\winpcaptests\pcap.h|132|warning: type defaults to `int' in declaration of `snaplen'|
C:\cdev\winpcaptests\pcap.h|132|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|133|error: syntax error before "linktype"|
C:\cdev\winpcaptests\pcap.h|133|warning: type defaults to `int' in declaration of `linktype'|
C:\cdev\winpcaptests\pcap.h|133|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|155|error: field `ts' has incomplete type|
C:\cdev\winpcaptests\pcap.h|156|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|156|warning: no semicolon at end of struct or union|
C:\cdev\winpcaptests\pcap.h|157|warning: type defaults to `int' in declaration of `len'|
C:\cdev\winpcaptests\pcap.h|157|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|164|error: syntax error before "u_int"|
C:\cdev\winpcaptests\pcap.h|164|warning: no semicolon at end of struct or union|
C:\cdev\winpcaptests\pcap.h|165|warning: type defaults to `int' in declaration of `ps_drop'|
C:\cdev\winpcaptests\pcap.h|165|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|166|error: syntax error before "ps_ifdrop"|
C:\cdev\winpcaptests\pcap.h|166|warning: type defaults to `int' in declaration of `ps_ifdrop'|
C:\cdev\winpcaptests\pcap.h|166|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|215|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|215|warning: no semicolon at end of struct or union|
C:\cdev\winpcaptests\pcap.h|231|error: syntax error before '*' token|
C:\cdev\winpcaptests\pcap.h|235|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|241|error: syntax error before "u_char"|
C:\cdev\winpcaptests\pcap.h|242|error: syntax error before "u_char"|
C:\cdev\winpcaptests\pcap.h|243|error: syntax error before '*' token|
C:\cdev\winpcaptests\pcap.h|244|warning: type defaults to `int' in declaration of `pcap_next'|
C:\cdev\winpcaptests\pcap.h|244|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|245|warning: type defaults to `int' in declaration of `u_char'|
C:\cdev\winpcaptests\pcap.h|245|error: syntax error before '*' token|
C:\cdev\winpcaptests\pcap.h|248|warning: "struct bpf_program" declared inside parameter list|
C:\cdev\winpcaptests\pcap.h|248|warning: its scope is only this definition or declaration, which is probably not what you want|
C:\cdev\winpcaptests\pcap.h|254|warning: type defaults to `int' in declaration of `u_char'|
C:\cdev\winpcaptests\pcap.h|254|error: syntax error before '*' token|
C:\cdev\winpcaptests\pcap.h|258|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|260|error: syntax error before "bpf_u_int32"|
C:\cdev\winpcaptests\pcap.h|261|warning: "struct bpf_program" declared inside parameter list|
C:\cdev\winpcaptests\pcap.h|283|error: syntax error before '*' token|
C:\cdev\winpcaptests\pcap.h|291|error: syntax error before "bpf_filter"|
C:\cdev\winpcaptests\pcap.h|291|error: syntax error before "u_char"|
C:\cdev\winpcaptests\pcap.h|291|warning: type defaults to `int' in declaration of `bpf_filter'|
C:\cdev\winpcaptests\pcap.h|291|warning: data definition has no type or storage class|
C:\cdev\winpcaptests\pcap.h|292|warning: "struct bpf_insn" declared inside parameter list|
C:\cdev\winpcaptests\pcap.h|293|warning: "struct bpf_insn" declared inside parameter list|
C:\cdev\winpcaptests\pcap.h|294|warning: "struct bpf_program" declared inside parameter list|
C:\cdev\winpcaptests\main.c||In function `main':|
C:\cdev\winpcaptests\main.c|13|warning: implicit declaration of function `pcap_findalldevs_ex'|
C:\cdev\winpcaptests\main.c|13|error: `PCAP_SRC_IF_STRING' undeclared (first use in this function)|
C:\cdev\winpcaptests\main.c|13|error: (Each undeclared identifier is reported only once|
C:\cdev\winpcaptests\main.c|13|error: for each function it appears in.)|
C:\cdev\winpcaptests\main.c|20|error: dereferencing pointer to incomplete type|
C:\cdev\winpcaptests\main.c|22|error: dereferencing pointer to incomplete type|
C:\cdev\winpcaptests\main.c|23|error: dereferencing pointer to incomplete type|
C:\cdev\winpcaptests\main.c|24|error: dereferencing pointer to incomplete type|
||=== Build finished: 32 errors, 35 warnings ===|


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winpcap.org/pipermail/winpcap-users/attachments/20090201/399d5876/attachment-0001.htm


More information about the Winpcap-users mailing list