The WIN32 macro is not defined in gcc under MSYS2/MinGW, so compiling any program using liblo (the version in MSYS2 repository) produces an error.
In file included from C:/msys64/mingw64/include/lo/lo.h:28,
from test.c:7:
C:/msys64/mingw64/include/lo/lo_endian.h:27:10: fatal error: netinet/in.h: No such file or directory
27 | #include <netinet/in.h>
| ^~~~~~
compilation terminated.
Adding the
#include <winsock2.h>
header fixes the problem.
The _WIN32 macro should be preferred over WIN32. _WIN32 is defined by compilers on Windows, so MSVC, gcc, etc. all support this flag, but WIN32 is defined by the user or SDK (visual studio). It is not defined by gcc on Windows.
The
WIN32
macro is not defined ingcc
under MSYS2/MinGW, so compiling any program using liblo (the version in MSYS2 repository) produces an error.Adding the
header fixes the problem.
The
_WIN32
macro should be preferred overWIN32
._WIN32
is defined by compilers on Windows, so MSVC,gcc
, etc. all support this flag, butWIN32
is defined by the user or SDK (visual studio). It is not defined bygcc
on Windows.