Articles

How to run c program in linux

January 30, 2006 at 20:58:22
Specs: Red Hat Linux 7, 2 Ghz

How to compile and execute c / c++ program in Red Hat 7.0, help me, i am new to linux, and where can i get help for c/c++ programming using linux

See More: How to run c program in linux

Report •


#1
January 31, 2006 at 07:02:46

You probably have gcc installed, very simply:
$ gcc infile.c
will create an executable called a.out which you can run with:
$ ./a.out
"man gcc" for more details.

If you are compiling other applications as opposed to your own programs, packages are often compiled by:
$ ./configure
$ make
# make install
Always check any README and INSTALL files that might come with it first....


Report •

#2
February 1, 2006 at 23:12:11

Thanks for ur reply Mr.3Dave

But i dont know where can i get gcc, i tried in system tools->terminal. but there it is not working, it is not giving a.out file, also i am able compile using only #gcc command, not using $gcc.

Help me the complete process of working one small c program in RedHat Linux 7.0


Report •

#3
February 2, 2006 at 04:50:20

The "$" just indicates a prompt and does not need to be typed in. The "#" indicates a root prompt, to get this type in "su" and enter root's password.

What happens if you just type "gcc" without the quotes? You should get "gcc: no input files". If you get "gcc: command not found" then it is not installed. You should be able to find the rpm for you to install it on one of the installation CDs (usually in the development section if you have one). You could also install it with apt-get/yum and an internet connection.


Report •

Related Solutions


Ask Question