RH 7.2 buit-in C compiler? [Archive] - C Board

PDA

View Full Version : RH 7.2 buit-in C compiler?


Bud
06-28-2002, 02:34 PM
Does Linux Red Hat 7.2 have a built in C compiler? If so, how do I access it?
Thanks,
Bud

Unregistered
06-28-2002, 03:01 PM
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*"

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

int main()
{
puts( "hello world!" );
return 0;
}^D
gcc foo.c -o foo && ./foo

kwigibo
06-28-2002, 07:24 PM
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

ygfperson
06-28-2002, 10:03 PM
redhat does bundle gcc with it. as a matter of fact, it changed gcc 2.95.3 and renamed it 2.96RH.

itld
06-29-2002, 07:08 PM
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.

ygfperson
06-29-2002, 11:05 PM
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.)

onurak
07-17-2002, 07:25 PM
gcc and g++ come nearly with all dist.(rehat suse mandreke....) use man gcc/g++ to learn how it works