C
C
cython2020-06-30 19:53:29
C++ / C#
cython, 2020-06-30 19:53:29

How to fix error with mingw msys and winsock2?

When compiling a project, mingw throws an error in the standard winsock2.h header:
https://pastebin.com/E6ciRt80
(log too big, uploaded to pastebin)

Project code lines referenced by the compiler:
lib.h

#ifndef _LIB_H
#define _LIB_H

#include <winsock2.h>
#include <windows.h>
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WS08
#include <ws2tcpip.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <openssl/ssl.h>
#include <openssl/crypto.h>


lib.c
#include "lib.h"

#include "utils.h"


Compiled using Makfile created with CMake.
Compilation flags: -lws2_32 -lssl -lcrypto

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cython, 2020-06-30
@cython

Found the answer. It is necessary before connecting all libraries
#define WIN32_LEAN_AND_MEAN

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question