C programs

Marius Gedminas marius at pov.lt
Tue Feb 26 15:53:06 UTC 2008


On Tue, Feb 26, 2008 at 08:46:17AM -0700, Karl Larsen wrote:
>     I write in ANSI C and the gcc on Ubuntu 1.7 doesn't like it. Here is 
> the source code:
> 
> /* converts 2 fathoms to feet */
> #include <stdio.h>
> int main (void)
> {
>   int feet, fathoms;
> 
>   fathoms = 2;
>   feet = 6 * fathoms;
>   printf("There are %d feet in %d fathems!\n", feet, fathoms);
>   return 0;
>   }
> 
> When I run gcc it errors out with:
> 
> karl at karl-desktop:~/Cprog$ gcc fathm_ft.c
> fathm_ft.c:2:19: error: stdio.h: No such file or directory
> 
>     Now it can't find stdio.h and why is that?

You do not have the libc6-dev package installed.  Other things might be
missing as well -- if you want to build C programs, install the
build-essential package to make sure you get all the necessary packages.

> I thought stdio.h is a standard C header.

Yes it is, but the C standard library headers are shipped in a different
package from the C compiler.

Marius Gedminas
-- 
There are a lotta computer languages out there doing drugs.
		-- Larry Wall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080226/ce5a27c0/attachment.sig>


More information about the ubuntu-users mailing list