Thread: RH 7.2 buit-in C compiler?

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

  2. #2
    Unregistered
    Guest
    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

  3. #3
    Registered User
    Join Date
    Sep 2001
    Location
    Fiji
    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

  4. #4
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    redhat does bundle gcc with it. as a matter of fact, it changed gcc 2.95.3 and renamed it 2.96RH.

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

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    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.)

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

Popular pages Recent additions subscribe to a feed

Similar Threads

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