Solution to no such directory or file when compiling with headers such as stdio.h stdlib.h on Linux

Solution to no such directory or file when compiling with headers such as stdio.h stdlib.h on Linux:

Say you have a c file “helloworld.c”. It contains header such as “stdio.h”, “stdlib.h”, but unable to compile with gcc. In order to solve it run this command on terminal,

sudo apt-get update && sudo apt-get --reinstall install libc6-dev

If it asks to [Y/n] press Y and continue installation. After installation is complete it should be able to compile properly.

compiling and running c program from terminal in linux
compiling and running c program from terminal in linux

Now just follow code shown above to run your code from terminal.