How to run c program in linux

Vote Down
Score
2
Vote Up
January 30, 2006 at 20:58:22 Pacific
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

Reply ↓  Report •


#1
Vote Down
Score
26
Vote Up
January 31, 2006 at 07:02:46 Pacific

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....


Reply ↓  Report •

#2
Vote Down
Score
4
Vote Up
February 1, 2006 at 23:12:11 Pacific

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


Reply ↓  Report •

#3
Vote Down
Score
2
Vote Up
February 2, 2006 at 04:50:20 Pacific

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.


Reply ↓  Report •

Reply to Message Icon Start New Discussion
Related Posts

« Monitoring xterm Cant connect Linux to int... »

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.

Ask the Community!
Describe your Problem
Example: Hard Drive Not Detected on My PC