lsalzman / enet

ENet reliable UDP networking library
MIT License
2.72k stars 670 forks source link

ws2ipdef.h is not enought, ws2tcpip.h is needed as well - for Windows cross compile from Linux #235

Closed GuiguiBlitz closed 5 months ago

GuiguiBlitz commented 7 months ago

When trying to build from ubuntu for windows with mingw-w64, we are facing issues with IP_TTL variable not defined. Is seems that including ws2tcpip.h is needed, as well as already present ws2ipdef.h For functions getsockopt() and setsockopt() IP_TTL behing defined in ws2tcpip.h

/home/vscode/.cargo/registry/src/index.crates.io-6f17d22bba15001f/enet-sys-1.0.4/vendor/enet/win32.c: In function ‘enet_socket_get_option’:
  /home/vscode/.cargo/registry/src/index.crates.io-6f17d22bba15001f/enet-sys-1.0.4/vendor/enet/win32.c:258:54: error: ‘IP_TTL’ undeclared (first use in this function)
    258 |             result = getsockopt (socket, IPPROTO_IP, IP_TTL, (char *) value, & len);
        |                                                      ^~~~~~
  gmake[2]: *** [CMakeFiles/enet.dir/build.make:197: CMakeFiles/enet.dir/win32.c.obj] Error 1
  gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/enet.dir/all] Error 2
  gmake: *** [Makefile:136: all] Error 2
  thread 'main' panicked at /home/vscode/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:
lsalzman commented 5 months ago

Fixed