Saturday, October 6, 2007

Error in compiling

Somehow I assumed that I would be able to compile a basic C program on any linux box - I mean unices are useful like that, right? So I was a bit surprised when I decided to compile a bit of C just now and was faced with the following errors:

arvind@lovely:gcc-4.1 try.c -o try.out

try.c:1:18: error: stdio.h: No such file or directory
try.c:2:22: error: sys/types.h: No such file or directory
try.c: In function ‘main’:
try.c:5: warning: incompatible implicit declaration of built-in function ‘printf’

So what kind of unix comes with make and a compiler, but none of the required dev libraries and headers required to make any normal C program work? Well a brief google yielded the following solution.. Yup, you guessed it.. you need to install a dev package:

sudo apt-get install build-essential

it works...........

No comments: