qt工程加入libnids

pro--------------------------

LIBS += F:/MyProjects/qt_libnids/lib/libpcap.lib /
        F:/MyProjects/qt_libnids/lib/libnids.lib /
        F:/MyProjects/qt_libnids/lib/WS2_32.Lib /
        F:/MyProjects/qt_libnids/lib/wpcap.lib /
        F:/MyProjects/qt_libnids/lib/bufferoverflowu.lib

 

INCLUDEPATH += F:/MyProjects/qt_libnids/inc

 

main.cpp--------------------------

#include "winpcap/pcap.h"

 

main()--------------------------

    pcap_if_t *alldevs;
    char errbuf[1024+1];
    pcap_if_t *d;
    int i=0;
    if(pcap_findalldevs(&alldevs, errbuf) == -1)
    {
        fprintf(stderr,"Error in pcap_findalldevs: %s/n", errbuf);
        exit(1);
    }
    for(d=alldevs; d!=NULL; d=d->next)
    {
        printf("%d. %s/n",++i,d->name);
    }
    if (i == 0)
    {
        printf("/nNo interfaces found! Make sure WinPcap is installed./n");
        return 0;
    }
    pcap_freealldevs(alldevs);

 

nids.h--------------------------

#ifdef __cplusplus
  extern "C" {
#endif
    int nids_init ();

    ...

#ifdef __cplusplus
  }
#endif

你可能感兴趣的:(qt工程加入libnids)