Some code and associated warnings/errors:
#include <windows.h>
#include <iphlpapi.h>
int main() { }
F:/Prog/mingw-w64/x86_64-4.9.2-win32-seh-rt_v3-rev1/mingw64/x86_64-w64-mingw32/include/ws2ipdef.h:71:3: error: '
ADDRESS_FAMILY
' does not name a typeADDRESS_FAMILY si_family;
#include <windows.h>
#include <winsock2.h>
#include <iphlpapi.h>
int main() { } // this compiles successfully, only gives warning
F:/Prog/mingw-w64/x86_64-4.9.2-win32-seh-rt_v3-rev1/mingw64/x86_64-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
#include <winsock2.h>
#include <windows.h>
#include <iphlpapi.h>
int main() { }
(compilation successful).
My questions are:
- Why doesn't
iphlpapi.h
(and other files that rely on winsock) do#include <winsock2.h>
themself, or at least give a nicer error message? - Why does there a warning for it to come before
windows.h
?
#warning
on the way – M.M