zpl-c / enet

⚡️ ENet reliable UDP networking library
https://blog.zpl.pw
MIT License
650 stars 62 forks source link

Compilation with MinGW-W64 #32

Closed qtnc closed 1 year ago

qtnc commented 3 years ago

Hello,

IN order to make the code compilable with MinGW-W64 in C++, two fixes are needed.

1 - IN enet.h:5103, a void cast is required:
- if (inet_ntop(AF_INET6, &address->host, name, nameLength) == NULL) {
`+ if (inet_ntop(AF_INET6, (void
)&address->host, name, nameLength) == NULL) {`

Additionally, there are warnings if you compile with -Wextra, related to enum>integer conversions.

2- You need to make sure that _WIN32_WINNT >= 0x0600
#define _WIN32_WINNT 0x0600

This is because inet_ntop and inet_nton are only available since Windows Vista. Of course, as a consequence, this library isn't compatible with Windows XP, but in 2021 this should no longer be a big problem...

Otherwise the library seem to work as well as the original ENet, both in IPv4 and IPv6. Thank you very much for this fork of ENet.

inlife commented 1 year ago

Added fixes in the commit: https://github.com/zpl-c/enet/commit/f668588a8c5403c30eddf87056e0f2c52a51ece4 Thanks!