Where's my /usr/include/sys directory?

If you use Ubuntu on 64-bit (I can't text exactly right now on a 32-bit system), then the directory from the question is:

/usr/include/x86_64-linux-gnu/sys

Now, having this information, you can create symbolic links to those files if you really need them at that location (/usr/include/sys) using this on a terminal:

sudo ln -s /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/sys/types.h
sudo ln -s /usr/include/x86_64-linux-gnu/sys/stat.h /usr/include/sys/stat.h

# ...etc

install libc6-dev-amd64 if you working on a 64-bit linux. Type the following command on the ubuntu terminal:

sudo apt-get install libc6-dev-amd64

Let's check what gcc's default include search path is. From this answer, we get this command:

gcc -xc -E -v -

At the end of the output, I see this on my machine:

ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include

Notice the second-to-last line. That means that when you compile a C file with #include <sys/stat.h>, gcc will look for /usr/include/x86_64-linux-gnu/sys/stat.h before trying /usr/include/sys/stat.h, without us having to symlink anything.

Tags:

C

Gcc