'linux/if_tun.h on Windows (mingw64)

How can I fix this error in mingw64?

gcc -O2 -Wall -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -MMD -D_GNU_SOURCE -DCONFIG_VERSION=\"2019-12-21\" -DCONFIG_SLIRP -DCONFIG_FS_NET -DCONFIG_SDL -DCONFIG_RISCV_MAX_XLEN=128 -DCONFIG_X86EMU -c -o temu.o temu.c
temu.c:39:10: fatal error: linux/if_tun.h: No such file or directory
   39 | #include <linux/if_tun.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:129: temu.o] Error 1

I'm trying to compile tinyemu.



Solution 1:[1]

It turns out I need to remove everything in a "#ifndef" area that is not supposed to be used on Windows.

#ifndef _WIN32
#include <termios.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/if_tun.h>
#endif

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 9pfs supports Ukraine