Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-27-2013, 02:46 AM   #1
sahana banerjee
LQ Newbie
Registered: Feb 2013
Posts: 1

Rep: Reputation: 0
Unhappy programming in c/c++ in redhat linux 5.5

can any one tell me how to compile and run a c/c++ programming script in redhat linux 5.5?? I am not being successfull in the compilation of the code ??
Old 02-27-2013, 03:13 AM   #2
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
To compile C program on Linux terminal

1) Write any C program in text editor and save as filename.c
In following example, I have saved this file on my Desktop.

2) To run this program, you have to compile it first.

$ gcc -o compiled-filename /home/user/Desktop/filename.c
Where compiled-filename is the name of compiled file, it can be anything.
This will generate a compile copy of your program as a name compiled-filename in same directory where you ran the above command.

3) Now create output copy of your program.
Following command generate a output file of your program in same directory.

$ gcc /home/user/Desktop/filename.c
4) Now run your program.

$ ./a.out 
$ ./compiled-filename
where a.out is output copy of your program.
Alternatively you can run compiled copy of your program.

2 members found this post helpful.
Old 02-27-2013, 03:31 AM   #3
Registered: Feb 2013
Location: Land of Hopenchange
Distribution: Slackware
Posts: 45

Rep: Reputation: Disabled
Originally Posted by sahana banerjee View Post
can any one tell me how to compile and run a c/c++ programming script in redhat linux 5.5?? I am not being successfull in the compilation of the code ??
What errors are you getting? Does it fail at compile time, or link time?

Made certain you have gcc installed?

If failed at compile, you have a typo or some other sort of C/C++ syntax violation. If failed on link, maybe you didn't #include the necessary header files? Tried linking against a library that's not a "devel" version? Failed to register new libs with ldconfig?
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Network programming using DMA and RDMA on RedHat Linux with Intel nehalem. Jacob1299 Linux - Networking 1 04-06-2010 10:49 PM
With what tools can I do Desktop Programming in Redhat 9 Linux? linuxdullhead Programming 3 12-23-2004 07:46 PM
how to use the programming in Redhat 9 nick27 Programming 1 12-07-2003 11:30 AM
Programming C with RedHat jacksmash Linux - Software 4 11-02-2003 01:31 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:03 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration