fatal error: sys/io.h: No such file or directory

created at 08-26-2022 views: 30


The reason is that the location of io.h is different for different Linux platforms.

  • io.h under Windows can be included directly;
  • The Linux platform is under the sys/ folder;
  • The ARM architecture system is under the sys/ folder, and the name is different, it becomes uio.h

The solution is to add a macro definition branch when including io.h to detect whether the current platform is Windows, x86 Linux or ARM Linux. For example (__ARM__ is a macro definition added in your project.):

#ifdef WIN32
#include <io.h>
#elif defined(__ARM__)
#include <sys/uio.h>
#include <sys/io.h>
created at:08-26-2022
edited at: 08-26-2022: