diff --git a/examples/complete/Makefile b/examples/complete/Makefile index fcd52d6c..d4cb59a6 100644 --- a/examples/complete/Makefile +++ b/examples/complete/Makefile @@ -25,7 +25,7 @@ mingw: vc98: $(VC98) cl.exe /nologo $(CFLAGS) ../../test/pack.c /Fepack.exe $(VC98) cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c' - $(VC98) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) ws2_32.lib -o $(PROG).exe + $(VC98) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) /Fe$(PROG).exe $(VC98) $(PROG).exe clean: diff --git a/mongoose.c b/mongoose.c index 94cd5818..8fcf9bcf 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3102,6 +3102,7 @@ struct mg_connection *mg_sntp_connect(struct mg_mgr *mgr, const char *url, #define MG_SOCK_ERRNO WSAGetLastError() #ifndef SO_EXCLUSIVEADDRUSE #define SO_EXCLUSIVEADDRUSE ((int) (~SO_REUSEADDR)) +#pragma comment(lib, "ws2_32.lib") #endif #elif MG_ARCH == MG_ARCH_FREERTOS_TCP #define MG_SOCK_ERRNO errno diff --git a/src/sock.c b/src/sock.c index 45262463..db136e78 100644 --- a/src/sock.c +++ b/src/sock.c @@ -13,6 +13,7 @@ #define MG_SOCK_ERRNO WSAGetLastError() #ifndef SO_EXCLUSIVEADDRUSE #define SO_EXCLUSIVEADDRUSE ((int) (~SO_REUSEADDR)) +#pragma comment(lib, "ws2_32.lib") #endif #elif MG_ARCH == MG_ARCH_FREERTOS_TCP #define MG_SOCK_ERRNO errno