PDA

View Full Version : Error in compiling C



basukinjal
August 18th, 2008, 06:42 PM
Hello, Im pretty new to linux.

Whenever I try to cc search.c, I get:
search.c:1:19: error: stdio.h: No such file or directory
search.c: In function ‘main’:
search.c:7: warning: incompatible implicit declaration of built-in function ‘printf’

What do i need to do??
Please help!

dwhitney67
August 18th, 2008, 06:46 PM
You should be including stdio.h such as:

#include <stdio.h>
As for the rest of your program, I have no idea what you are doing, but it appears that you are calling printf().

int main()
{
printf( "Hello world!\n" );
return 0;
}
If you are still having trouble, maybe it is because you have not installed the compiler. Try:

$ sudo apt-get install build-essential

Kadrus
August 18th, 2008, 06:48 PM
Have you installed build-essential?

sudo apt-get install build-essential
and please post the output when you type : cc in terminal.