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.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s