C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-28-2002, 02:34 PM   #1
Bud
Registered User
 
Join Date: Jun 2002
Posts: 6
Exclamation RH 7.2 buit-in C compiler?

Does Linux Red Hat 7.2 have a built in C compiler? If so, how do I access it?
Thanks,
Bud
Bud is offline   Reply With Quote
Old 06-28-2002, 03:01 PM   #2
Unregistered
Guest
 
Posts: n/a
Try whereis gcc. If it returns /usr/bin/gcc, it's installed. Otherwise search your Red Hat cdroms; mkdir /cdrom; mount -t cd9660 /dev/cdrom /cdrom && find /cdrom -name "*gcc*"

Code:
cat > foo.c
#include <stdio.h>

int main()
{
  puts( "hello world!" );
  return 0;
}^D
gcc foo.c -o foo && ./foo
  Reply With Quote
Old 06-28-2002, 07:24 PM   #3
Registered User
 
Join Date: Sep 2001
Location: Australia
Posts: 212
you should do if you installed it on setup.

to test you do type

which gcc

this will tell you if you have it, if you do it'll tell where it is installed.

To use it you have to be in konsole, when you are there you can use it from any directory. Simply type

gcc -Wall filename -o program-Name

"-Wall" turns all warnings on
"-o program-Name" program-Name becomes the executable
"filename" can be a list of C files

if you don't use -o option, then it compiles the program to the default "a.out"

to run the program type:
./program

the dot-slash specifies the program is in the current directory

hope this helps

kwigibo
kwigibo is offline   Reply With Quote
Old 06-28-2002, 10:03 PM   #4
Just because
 
ygfperson's Avatar
 
Join Date: Jan 2002
Posts: 2,502
redhat does bundle gcc with it. as a matter of fact, it changed gcc 2.95.3 and renamed it 2.96RH.
ygfperson is offline   Reply With Quote
Old 06-29-2002, 07:08 PM   #5
In The Light
 
Join Date: Oct 2001
Posts: 598
howdy,
you might try this.
open a new file in emacs name it hello.cpp
code the "hello world" thing
go to the "tools" menu and select "Compile"
then open a terminal window and (like sugested before) type ./hello.
if this works your on your way.
on my RH 7.2 install the compiler defaults to gcc 2.96 and has all of the libraries pathed in corectly.

M.R.
__________________
I don't like you very much. Please post a lot less.
Cheez
*and then*
No, I know you were joking. My point still stands.
itld is offline   Reply With Quote
Old 06-29-2002, 11:05 PM   #6
Just because
 
ygfperson's Avatar
 
Join Date: Jan 2002
Posts: 2,502
that may not always work. on my emacs the compiler is not pre-determined. just run "gcc -v" at the command prompt and it should tell you something about gcc (or the fact that it doesn't exist.)
ygfperson is offline   Reply With Quote
Old 07-17-2002, 07:25 PM   #7
Registered User
 
Join Date: Jun 2002
Posts: 106
gcc and g++ come nearly with all dist.(rehat suse mandreke....) use man gcc/g++ to learn how it works
__________________
C++ Makes you Feel Better

"Gravity connot be held reponsible for people falling in love"--Albert Einstein
onurak is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler Paths... Cobra C++ Programming 5 09-26-2006 04:04 AM
C Compiler and stuff pal1ndr0me C Programming 10 07-21-2006 11:07 AM
I can't get this new compiler to work. Loduwijk C++ Programming 7 03-29-2006 06:42 AM
how to call a compiler? castlelight C Programming 3 11-22-2005 11:28 AM
Bad code or bad compiler? musayume C Programming 3 10-22-2001 09:08 PM


All times are GMT -6. The time now is 06:11 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22