Clang Error - stddef file not found?

haziz picture haziz · Dec 14, 2013 · Viewed 19.3k times · Source

After upgrading to Ubuntu 13.10 "Saucy", Clang now gives me the error message:

clang -Wall -Werror -std=c99 -ggdb -O0 5.1.c -o 5.1
In file included from 5.1.c:1:
/usr/include/stdio.h:33:11: fatal error: 'stddef.h' file not found
# include <stddef.h>
          ^
1 error generated.
make: *** [5.1] Error 1

BTW the header I included was stdio.h not stddef.h but I am assuming that stdio.h references or #includes stddef.h

Answer

Mohammad Azim picture Mohammad Azim · Oct 9, 2018

This error appeared for me when trying to run clang-tidy without clang installed.

Installing clang fixed this error. IMO this error occurs when clang-tidy looks for headers in GCC and system paths and clang version/symlink of these headers are missing.