2

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.

3
  • Sounds like a question for Super User.
    – Sampson
    Jul 20, 2009 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, 2009 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, 2009 at 19:17

3 Answers 3

9
$ sudo apt-get install build-essential
2
  • 1
    The package build-essentials contains all the standard libraries and include files needed for compiling c programs.
    – txwikinger
    Jul 20, 2009 at 17:39
  • 3
    The meta-package is named build-essential, not build-essentials
    – ephemient
    Jul 20, 2009 at 19:53
6
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.

0

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

#include <stdio.h>

You must log in to answer this question.