LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-20-2007, 04:14 AM   #1
moserbear
LQ Newbie
 
Registered: Sep 2007
Posts: 2

Rep: Reputation: 0
Compiling C Programs


I have installed linux today and created an account and logged in.
Then I started a new file by using the command
vi filename.c
I saved it.
Then I trien to run the program by
cc filename.c
---------

I got an error that says

cc: command not found

Please help!!
 
Old 09-20-2007, 04:16 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Try gcc instead. Perhaps you don't have a symlink called "cc" that points to gcc. If you get a command not found error again, you'll need to install gcc.
 
Old 09-20-2007, 04:28 AM   #3
moserbear
LQ Newbie
 
Registered: Sep 2007
Posts: 2

Original Poster
Rep: Reputation: 0
How to Install That . plz tell

Quote:
Originally Posted by Nylex View Post
Try gcc instead. Perhaps you don't have a symlink called "cc" that points to gcc. If you get a command not found error again, you'll need to install gcc.
Where to get it and to install it, plz tell
 
Old 09-20-2007, 05:12 AM   #4
xgreen
Member
 
Registered: Aug 2003
Distribution: Slackware,Ubuntu
Posts: 389

Rep: Reputation: 30
try
Quote:
which cc
&
Quote:
which gcc
if cc or gcc are not found in your default path then you need to install the gcc package. You can get gcc from your distribution repositories or from http://gcc.gnu.org/install/binaries.html

Last edited by xgreen; 09-20-2007 at 05:16 AM.
 
Old 09-20-2007, 05:16 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
It'll be easier to get it from your distribution's package manager. If you don't know what this is, you'll need to tell us which distro you're using.
 
Old 09-20-2007, 08:28 AM   #6
otoomet
Member
 
Registered: Oct 2004
Location: Tartu, Ċrhus,Nürnberg, Europe
Distribution: Debian, Ubuntu, Puppy
Posts: 619

Rep: Reputation: 45
Debian & friends (including ubuntu) have a nice package called 'build-essential'. It installs gcc and a bunch of other more-or-less necessary tools. I am not sure about Red-Hat family.

Another point -- if you are beginner, you may want to consider other text editors (although vi is powerful, hands down) or IDE-s. Vi may be awful to start with if you don't have much unix experience beforehand.

Best,
Ott
 
Old 09-20-2007, 05:57 PM   #7
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
generally the command to compile programs is
gcc <filename>.c -o <programname>
 
Old 09-20-2007, 07:39 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,294

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
Definitely add your distro info to your profile, that'll make our job easier.
BTW, on RH FC series, the menu to install etc is Applications->Add/Remove Software
 
  


Reply


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
compiling programs tgm4883 Fedora 6 03-17-2006 12:53 PM
Compiling C++ programs rchillal Linux - Newbie 13 02-08-2005 05:27 AM
I need help with compiling my C++ programs. bitessy Programming 3 02-23-2004 06:07 PM
Compiling Programs mike35 Linux - Newbie 2 10-22-2003 09:39 AM
compiling programs disorderly Linux - Newbie 2 10-17-2003 12:48 PM


All times are GMT -5. The time now is 04:25 AM.

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