execution of a c program in GCC compiler
I have wrote a c program in gedit and opened termina开发者_运维技巧l where the following symbol shown as
>
and now i tried to execute the program as
gcc filename.c
and am getting the output as
gcc: command not found
what is the error in doing this application?
That means that gcc is not installed. The steps for installing it depend on which Linux distro you are using. For Debian-based systems, you should try
sudo apt-get install build-essential
For Red Hat-based systems, try
sudo yum install gcc
You need to install gcc. Try sudo apt-get install gcc
(actually, sudo apt-get install build-essential
is a better idea), or sudo yum install gcc
.
Given that you're using gedit, I'm going to infer that you're running on some Linux system.
To clarify, what you tried to do with this command...
gcc filename.c
.. was to compile your program, filename.c. After executing this command successfully you would then need to run the compiled executable, which by default would be named a.out.
As per the other poster, the most likely cause of the error in invoking gcc is that you don't have the compiler installed. If you're running on Ubuntu or another Debian-based distro you can install gcc with apt-get; on other distributions like SuSE or Red Hat you can use yum.
精彩评论