gcc unable to locate header files

Asked by Subash

Hi,
  I am new to linux and gcc. Just installed ubuntu, and try to compile a c program using gcc, it says ¨stdio.h: No such a file or Directory¨. I dont know I need to install any development package or it is problem due to path settings.. Some one pls help me..
Thanks
subash

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
Subash
Solved:
Last query:
Last reply:
Revision history for this message
Arnaudus (a-lerouzic) said :
#1

Hi,

It is not clear from your question whether you try to compile an existing (working) C program, or a program you made by yourself. In case you wrote it, are you sure you have enclose stdio.h with <>? The correct syntax is

#include <stdio.h>

and NOT
#include "stdio.h"

Revision history for this message
Subash (subbaash) said :
#2

Hi,
  I used #include <stdio.h>.. Still not working.. I guess it is a installation packages missing.. My linux system is a VMware player operating ubuntuDesktop804., Is this distribution contains all the standard package for c/c++ development?.

Thanks
subash

Revision history for this message
Arnaudus (a-lerouzic) said :
#3

Hi,

I am afraid you did not answer the main question: are your trying to compile a program that works for sure?

First, make sure that you have gcc (I don't think gcc comes with the standard install). Open a terminal and type 'sudo apt-get install gcc'. Once it is installed, you can check its version with gcc --version.

Then, try to compile a program that is correct:

1) Open a terminal
2) type 'gedit test.c'
3 Copy and paste this example program
#include <stdio.h>

int main() {
  printf("Hello World!\n");
  return 0;
}
4) Save
5) Close gedit
6) Type 'gcc -c test.c'

I have just checked, and it works on my computer.

Hope it helps!

Revision history for this message
Subash (subbaash) said :
#4

Hi,
  Thanks Arnaudus for looking in to my problem.. I solved this by installing "libc-dev" and "libc6" packages.. by default it didn't get installed..

Thanks
subash

Revision history for this message
gerald davis (breezecool28) said :
#5

Amaudus I tried that program also im not sure if it worked if it did it went to fast in the terminal any way to slow that down like Delay(140); or something like that in proper <header>

Thanks

Revision history for this message
Mark Rodighiero (markatango) said :
#6

I have the same problem. But the Ubuntu package manager says libc6, libc6-dev, libc6-dev-armel-cross, libc6-armel-cross, are all installed. Any further ideas?