When checking for <net/if.h>, #include <sys/socket.h> first.