Merge pull request #3241 from cesanta/mingw

Fixed mingw build error
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2025-08-13 10:48:53 -03:00
commit a00b3f1c6c
3 files changed
+28 -10

No files matched your search

+13 -4
View File
@@ -558,6 +558,17 @@ static inline int mg_mkdir(const char *path, mode_t mode) {
#define _CRT_RAND_S
#endif
#ifndef _WIN32_WINNT
#if defined(_MSC_VER) && _MSC_VER < 1700
#define _WIN32_WINNT 0x0400 // Let vc98 pick up wincrypt.h
#else
#define _WIN32_WINNT 0x0600
#endif
#endif
#ifndef WINVER
#define WINVER _WIN32_WINNT
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
@@ -585,6 +596,8 @@ static inline int mg_mkdir(const char *path, mode_t mode) {
#include <sys/types.h>
#include <time.h>
#include <winsock2.h> // fix missing macros and types
#if defined(_MSC_VER) && _MSC_VER < 1700
#define __func__ ""
typedef __int64 int64_t;
@@ -606,13 +619,9 @@ typedef enum { false = 0, true = 1 } bool;
#include <process.h>
#include <winerror.h>
#include <winsock2.h> // fix missing macros and types
// For mg_random()
#if defined(_MSC_VER) && _MSC_VER < 1700
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x400 // Let vc98 pick up wincrypt.h
#endif
#include <wincrypt.h>
#pragma comment(lib, "advapi32.lib")
#endif
+13 -4
View File
@@ -18,6 +18,17 @@
#define _CRT_RAND_S
#endif
#ifndef _WIN32_WINNT
#if defined(_MSC_VER) && _MSC_VER < 1700
#define _WIN32_WINNT 0x0400 // Let vc98 pick up wincrypt.h
#else
#define _WIN32_WINNT 0x0600
#endif
#endif
#ifndef WINVER
#define WINVER _WIN32_WINNT
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
@@ -45,6 +56,8 @@
#include <sys/types.h>
#include <time.h>
#include <winsock2.h> // fix missing macros and types
#if defined(_MSC_VER) && _MSC_VER < 1700
#define __func__ ""
typedef __int64 int64_t;
@@ -66,13 +79,9 @@ typedef enum { false = 0, true = 1 } bool;
#include <process.h>
#include <winerror.h>
#include <winsock2.h> // fix missing macros and types
// For mg_random()
#if defined(_MSC_VER) && _MSC_VER < 1700
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x400 // Let vc98 pick up wincrypt.h
#endif
#include <wincrypt.h>
#pragma comment(lib, "advapi32.lib")
#endif
+2 -2
View File
@@ -205,11 +205,11 @@ vc22: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/vc22 wine64 $@.exe
mingw: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) $(TFLAGS) -lwsock32 -lbcrypt -o $@.exe
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) $(TFLAGS) -lws2_32 -lbcrypt -o $@.exe
$(DOCKER) mdashnet/mingw wine64 $@.exe
mingw++: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) $(TFLAGS) -lwsock32 -lbcrypt -o $@.exe
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) $(TFLAGS) -lws2_32 -lbcrypt -o $@.exe
@echo "NOT RUNNING"
linux-libs: CFLAGS += -fPIC