sys/select.h
will not work because they don't exist. Here's a step-by-step guide to get the libmicrohttpd demo working on MSVC.- Add the include directory.
- Make sure code generation runtime library is set to multi-threaded DLL (
/MDd
or/MD
). - Include the library directory (
/lib
and/bin
). - Add dependency
libmicrohttpd.dll.a
andWs2_32.lib
- Go to Linker > All Options and make sure
/SAFESH
is not Yes. (Am usinglibmicrohttpd-0.9.17-w32
, not sure for newer versions). - Finally, include also the following.
#ifndef MHD_PLATFORM_H
#define MHD_PLATFORM_H
#include <winsock2.h> // socket related definitions
#include <ws2tcpip.h> // socket related definitions
#include <sys/types.h>
typedef SSIZE_T ssize_t; //Windows type to unix type
typedef UINT64 uint64_t; //Windows type to unix type
typedef UINT16 uint16_t; //Windows type to unix type
#endif
#include <microhttpd.h>
...
That should be about it.
libmicrohttpd-0.9.17-w32 has known vulnerabilities, it is strongly advised to use one of the newer versions. For further information check out this link.
ReplyDeleteIt's also easy to run it with MinGW-GCC under windows. the "typedef SSIZE_T ssize_t" is not needed in this case.
ReplyDeleteThank You and I have a tremendous offer you: Where Do You Get The Money To Renovate A House home renovation planning
ReplyDelete