vikash
vikash

Reputation: 63

manual installation of gcc

i dont have internet connection, so i installed gcc on my linux system manually through its debian package. but i am not able to compile any c code. here is my sample c code.

#include <stdio.h>
main()
{
printf("Hellp world");
return 0;
}

the error that it shows:

ocpe@blrkec241972d:~$ gcc -o hello hello.c
hello.c:1:19: error: stdio.h: No such file or directory
hello.c: In function âmainâ:
hello.c:4: warning: incompatible implicit declaration of built-in function âprintfâ

I think i have not installed all the dependencies of compiler. Plz suggest me descriptive way to install it correctly..

Upvotes: 0

Views: 3945

Answers (3)

TOC
TOC

Reputation: 4446

What about this gcc -Wall hello.c -o hello -I/usr/include/stdio.h?

You can see your include search path by using:

echo | gcc -v -x c -E -

On my Ubuntu Linux machine i can see this output for the previous command:

#include \"...\" search starts here:
/usr/lib/gcc/i686-linux-gnu/4.6.1/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/4.6.1/include-fixed
/usr/include/i386-linux-gnu
/usr/include

EDIT :

Install build-essential

Download from here : http://packages.debian.org/squeeze/i386/build-essential/download (assume you are 32 bits), and install dowloaded package like this:

dpkg -i build-essential.deb

Upvotes: 1

twalberg
twalberg

Reputation: 62479

On my Debian system, the header files are in another package libc6-dev. You're probably missing that (and some others as well, I would guess).

Upvotes: 0

derobert
derobert

Reputation: 51197

Assuming by "installed manually", you mean "using dpkg -i", then you need to also install libc6-dev. I suggest further installing, at very minimum, build-essential and everything it depends on.

Debian actually has a few programs to help with offline package installation. One option is of course to use CD/DVD images. Another is to use something like apt-offline.

Upvotes: 1

Related Questions