Results 1 to 5 of 5
hello, i am new to linux.
i am trying to learn both c and linux. and when i tried to write my first program this is what happened.
:~$ gcc ...
- 01-14-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
Cannot compile C programs
hello, i am new to linux.
i am trying to learn both c and linux. and when i tried to write my first program this is what happened.
:~$ gcc 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’
this is the program i wrote using vi
#include <stdio.h>
int main()
{
printf("hello azel");
return 0;
}
please help.
- 01-14-2009 #2
Your compiler cannot find the header file stdio.h.
Usually, this file is to be found in the /usr/include/ directory.
If this file is in a different place, you can tell the compiler to look into that directory too with the -I option.Debian GNU/Linux -- You know you want it.
- 01-14-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
thanks for replying.
i cudn't find the header file in that location. and i dnt know how to find it anywhere else.
somebody told me that i might not have GNU installed or it may be corrupted.
so i tried this.
:~$ sudo apt-get install GNU
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package GNU
now i am really confused. i am not being able to run the simplest c program.
- 01-14-2009 #4
GNU is the operating system you use, consisting of thousends of programs

You do not want to install all of these.
What you want is the GNU Compiler Collection, "gcc", especially the C and the C++ compiler and the development runtime files.
I think they are called "gcc", "g++". Depends on which flavour of GNU/Linux you use.
Ubuntu?
sudo apt-get install gcc build-essentialDebian GNU/Linux -- You know you want it.
- 01-17-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
Thank You
Hey, thanks alot. I installed it, and it worked.

finally i like linux, thanks to you.


Reply With Quote
