-   Programming (
-   -   gcc problem: standard libs not found (

Tzolkin 10-21-2007 08:00 PM

gcc problem: standard libs not found
Hi.. I'm a beginner with Linux and C programming, but I have a fairly huge problem..

I started out with this code:

#include <stdio.h>

int main()
    printf( "I am alive! Beware.\n" );
    return 0;

It looks fine, and compiled on cygwin, but in Kubuntu 7.10, it gives this error:

>> gcc test.c
test.c:1:19: error: stdio.h: No such file or directory
test.c: In function ‘main’:
test.c:5: warning: incompatible implicit declaration of built-in function ‘printf’

So, I searched the forums and tried 'locate stdio.h' and it returned something in perl called nostdio.h, but not what I wanted. So I tried looking for iostream.h.. nothing at all that time. I'm confused. I thought having gcc on the computer would mean the libs would be there. Why are they not, and how do I get them? Also, I checked Adept Manager and it has a bunch of different gcc things, a few of which I have installed, like gcc, then gcc3.2 or something. It's weird...

Anyone out there know how to make sense of this?


EDIT: Blah.. I found the package for libc++-dev and installed it finally. The only one so far which required the CD. Things work now. :P

aakhan 10-22-2007 01:03 AM

I never expect variants of Ubuntu to ship with development libraries. I don't have a Linux system at hand, but I think you need to have libstd installed.

If you run find / -type f -name 'stdio.h' -print, you will be able to establish whether the standard C library is present on your system or not.

bigearsbilly 10-22-2007 02:59 AM

hmm, sounds like you will need to download the development packages
(which will have all the header files),
strange though you have the compiler but no header files????

go into synaptic and look under development.

brianL 10-22-2007 06:32 AM

You need the build-essentials package, get it via Synaptic or apt-get.

Tzolkin 10-23-2007 03:24 PM

I installed the dev packages. Programs compile now, heh. I still think it's weird that gcc would be installed but not the header files. :P


Peatmoss 11-29-2007 06:41 PM

I am having the same problem and found several references to the proper resolution. I have Ubuntu 7.04 running on a desktop machine and so far everything seems to work. This missing stdio.h file, etc. seems to be a fact of life with this, and maybe other, distro. However, on my machine, if I run

sudo apt-get install build-essential

I get the following errors:

------------ Start of quote

Some packages could not be installed. This may mean you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or moved out of Incoming.

Since you only requested a single operation it is extremely likely that the package is simply not installable and a bug report against that package should be filed. The following information may help resolve the situation:

The following packages have unmet dependencies:
build-essential: Depends: libc6-dev but it is not going to be installed or libc-dev
Depends: g++ (>= 4:4.1.1) but it is not going to be installed
Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed

E: Broken packages

------------------ End quote

So... does anyone know how to proceed on this? '

This question would probably be better asked on the Distributions:Ubuntu forum, but this thread already existed.


Peatmoss /Alleria

I've redirected this to another forum since it doesn't really belong here. Sorry for the messup...


bipul 04-02-2008 10:13 AM

Try installing the g++
and then compile ur c programs on gcc.
It will work I suppose.
Prior to g++ installation we had these probs.
Once g++ was put in the files like stdio.h etc came in with the g++ lib
& dependencies...
good luck try. it....
May be this solution may not be upto the mark for many!

All times are GMT -5. The time now is 04:04 AM.