Computing.Net > Forums > Linux > How to run c program in linux

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to run c program in linux

Reply to Message Icon

Name: Moh
Date: January 30, 2006 at 20:58:22 Pacific
OS: Red Hat Linux 7
CPU/Ram: 2 Ghz
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: 3Dave
Date: January 31, 2006 at 07:02:46 Pacific
Reply:

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


0

Response Number 2
Name: Moh
Date: February 1, 2006 at 23:12:11 Pacific
Reply:

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


0

Response Number 3
Name: 3Dave
Date: February 2, 2006 at 04:50:20 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: How to run c program in linux

how to run c program in ubuntu www.computing.net/answers/linux/how-to-run-c-program-in-ubuntu/30296.html

Running c program in linux www.computing.net/answers/linux/running-c-program-in-linux/25556.html

C Code to run audio files in Linux www.computing.net/answers/linux/c-code-to-run-audio-files-in-linux/29571.html