Recently I had installed the Ubuntu flavour of the Linux operating system. I had opened a terminal and just wrote a sample C program to check if it is compiling. When I saved the sample file and compiled with cc a.c, errors comes that the standard library is not loaded (i.e stdio.h). When I went to help pages, it says that the C or C++ compiler doesnt gets loaded by default and we should do it ourselves.

So can anyone help me out to fix this problem, i.e to load the C/C++ compiler.

migrated from stackoverflow.com Jul 20 '09 at 17:15

This question came from our site for professional and enthusiast programmers.

  • Sounds like a question for Super User. – Sampson Jul 20 '09 at 17:14
  • stdio.h is not a library, if you get compilation errors please post them as well as the code so we can help you. – Fredrik Jul 20 '09 at 17:14
  • might I suggest (as I don't have high enough rep) the question being renamed to a question? I like this question as it's nice to see beginner stuff on these sites, so I'm not complaining, I just can't edit it myself. – codeLes Jul 20 '09 at 19:17
$ sudo apt-get install build-essential
  • 1
    The package build-essentials contains all the standard libraries and include files needed for compiling c programs. – txwikinger Jul 20 '09 at 17:39
  • 3
    The meta-package is named build-essential, not build-essentials – ephemient Jul 20 '09 at 19:53
sudo apt-get install build-essential

will install GNU Make, GCC, the development headers for Glibc or EGLIBC, and basic Debian package creation infrastructure.

For man pages, you will want to install the additional packages

sudo apt-get install manpages-dev manpages-posix-dev glibc-doc

Most libraries are split up into libfoo0, libfoo-dev, and libfoo-doc packages. (The numeric suffix on the first package may change for each ABI revision.) In order to use the library, you need libfoo0; in order to build binaries using the library, you will need libfoo-dev, and the purpose of libfoo-doc should be pretty obvious.


You need to add this to the beginning of your a.c file:

#include <stdio.h>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy