Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

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. –  Jonathan 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
add comment

3 Answers

$ sudo apt-get install build-essential
share|improve this answer
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
add comment
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.

share|improve this answer
add comment

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

#include <stdio.h>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.