WIN32 Compiling errors

I try to have mosquitto library working with pthread in my C++ programs, and dont find library ‘ready to use’.
The binary provide with unstaller does’t work in a multi-thread program.
So I try to compile the libmosquitto on Windows 7 with cmake 3.25, MINGW compiler and mosquitto-2.0.9 src.
When I try to compile, I have some errors. The first one:

cd /d C:\Users\ACE\Downloads\mosquitto-2.0.9\build\lib && C:\PROGRA~2\CODEBL~1\MinGW\bin\gcc.exe -DCMAKE -DVERSION="2.0.9" -DWITH_SOCKS -DWITH_THREADING -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -Dlibmosquitto_EXPORTS @CMakeFiles/libmosquitto.dir/includes_C.rsp -MD -MT lib/CMakeFiles/libmosquitto.dir/actions.c.obj -MF CMakeFiles\libmosquitto.dir\actions.c.obj.d -o CMakeFiles\libmosquitto.dir\actions.c.obj -c C:\Users\ACE\Downloads\mosquitto-2.0.9\lib\actions.c
In file included from C:\Users\ACE\Downloads\mosquitto-2.0.9\lib\actions.c:28:0:
C:\Users\ACE\Downloads\mosquitto-2.0.9\lib\net_mosq.h:26:17: error: conflicting types for ‘ssize_t’
typedef SSIZE_T ssize_t;
In file included from C:/PROGRA~2/CODEBL~1/MinGW/include/pthread.h:64:0,
from C:\Users\ACE\Downloads\mosquitto-2.0.9\lib\mosquitto_internal.h:37,
from C:\Users\ACE\Downloads\mosquitto-2.0.9\lib\actions.c:24:
C:/PROGRA~2/CODEBL~1/MinGW/include/sys/types.h:118:18: note: previous declaration of ‘ssize_t’ was here
typedef _ssize_t ssize_t;
Any ideas ?

You could try commenting out the typedef SSIZE_T ssize_t; line in config.h as a first try. If it is already defined on mingw then that is a safe thing to do.

Alternatively you could try out the installer at - this is a pre-release version which also includes thread support.



Thank you for your help.
Of course I’ve tried to comment this line, but there is too many others errors after that.

cd /d C:\mosquitto-master\build\lib && C:\PROGRA~2\CODEBL~1\MinGW\bin\gcc.exe -DCMAKE -DVERSION="2.0.15" -DWITH_SOCKS -DWITH_THREADING -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -Dlibmosquitto_EXPORTS @CMakeFiles/libmosquitto.dir/includes_C.rsp -o CMakeFiles\libmosquitto.dir\loop.c.obj -c C:\mosquitto-master\lib\loop.c
C:\mosquitto-master\lib\loop.c: In function ‘mosquitto_loop_forever’:
C:\mosquitto-master\lib\loop.c:275:15: error: ‘EPROTO’ undeclared (first use in this function)
if(errno == EPROTO){

cd /d C:\mosquitto-master\build\lib && C:\PROGRA~2\CODEBL~1\MinGW\bin\gcc.exe -DCMAKE -DVERSION="2.0.15" -DWITH_SOCKS -DWITH_THREADING -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -Dlibmosquitto_EXPORTS @CMakeFiles/libmosquitto.dir/includes_C.rsp -o CMakeFiles\libmosquitto.dir\util_mosq.c.obj -c C:\mosquitto-master\lib\util_mosq.c
C:\mosquitto-master\lib\util_mosq.c: In function ‘util__random_bytes’:
C:\mosquitto-master\lib\util_mosq.c:258:2: error: unknown type name ‘HCRYPTPROV’
HCRYPTPROV provider;
and so on…

Is it possible to have a win32 pre-release of mosquitto library 2.1 (with threads) ?