I'm making a bandwidth usage monitor using QT creator and every time I include Ws2tcpip.h I get a dozen of compilation errors like: error: redefinition of 'struct ip_mreq'
I only included the header file and still get many errors
#include "bandwidth_usage.h"
#include <windows.h>
#include <winsock2.h>
#include <Ws2tcpip.h>
Bandwidth_Usage::Bandwidth_Usage()
{
}
int Bandwidth_Usage :: get () {
}
The including <windows.h>
and <winsock2.h>
order makes a difference.
The following code works for me. Also see the accept function example .
#include <winsock2.h>
#include <WS2tcpip.h>
#include <stdio.h>
#include <windows.h>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.