WinPcap configuration under VS2012 Qt5 X64

Source: Internet
Author: User

Recently Learning Network programming, want to use QT in Windows to do a network capture tool, it is necessary to use WINPCAP, and my Computer system is Win7 64-bit, QT version is QT 5.3.1 for Windows 64-bit (VS, OpenGL), QT and WinPcap are therefore configured under the WIN7 64-bit system.

1, to http://www.winpcap.org/install/default.htm download the latest WinPcap installation package, and install, run the WinPcap-based program needs its support.

2. To http://www.winpcap.org/devel.htm download the development package, copy all the contents of the Include directory in the WinPcap development package to the QT msvc2013_64_opengl/include directory.

3. Copy the Packet.lib and Wpcap.lib under the x64 directory in the Lib directory in the WinPcap development package to the Msvc2013_64_opengl/lib directory.

Complete the three steps above and you can.

Here is an example of a test.

Create a new empty QT project and add main.cpp.

#include <stdio.h>
#include <stdlib.h>
#define Have_remote
#include <pcap.h>
int main ()
{
    pcap_if_t *alldevs;
    pcap_if_t *d;
    int i = 0;
    Char Errbuf[pcap_errbuf_size];
    /* Get local devices */
    if (PCAP_FINDALLDEVS_EX (pcap_src_if_string, NULL, &alldevs, errbuf) = =-1)
    {
        fprintf (stderr, "Error in PCAP_FINDALLDEVS_EX:%s\n", errbuf);
        Exit (1);
    }
    /* Print Devices 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;
    }
    Pcap_freealldevs (Alldevs);
    return 0;
}
SOURCE Link: http://download.csdn.net/detail/qq_17242957/9469072

http://blog.csdn.net/qq_17242957/article/details/50953630

http://blog.csdn.net/qq_17242957/article/details/50979646

WinPcap configuration under VS2012 Qt5 X64

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.