Cant compile - no gcc found on system

Discussion in 'Mac Programming' started by ciik13, Sep 24, 2009.

  1. ciik13 macrumors newbie

    Joined:
    Sep 24, 2009
    #1
    Running on OS X 10.5.8

    Really new to this, going through a tutorial and learning how to compile a program in unix.
    when i put the:
    % ./configure --prefix=$HOME/units174

    command , I get the following error message:
    loading cache ./config.cache
    checking for gcc... gcc
    checking whether the C compiler (gcc ) works... no
    configure: error: installation or configuration problem: C compiler cannot create executable

    Im assuming i have no gcc installed, so....
    I look up in forums and i read i need xcode installed, in order to have gcc and it should already be on my system somewhere..?
    so i went on mac developer tools and the xcode download wont install on 10.5.8, it says i need 10.6

    so lost on this..any help would be really appreciated.

    where can i find xcode on my system?
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
  3. mac2x macrumors 65816

    Joined:
    Sep 19, 2009
    #3
    I installed Xcode 3.0 from the DVD, and then got my free ADC membership to get Xcode 3.1. It's worth it to get 3.1 IMO unless for some reason you need 3.0. Of course you can run both if you prefer.

    I'm a bit of a programming neophyte, but I've learned so much! I believe gcc and g++ are part of the Unix command line, if I'm not mistaken...
     
  4. abbaskywalker macrumors newbie

    Joined:
    Jun 9, 2009
    #4
    hi guys
    yesterday i just began to my university lıfe with department of computer engineering. my teacher gave me the homework that
    first, show your name on the screen
    second, using with "/n" , write various privacy infos in many lines.

    my question is that how can i compile what i wrote? i searched and installed xcode 3.4. but i have snow leo and i guess it requires newer version of gcc.4 or 4.2 . i downloaded the xcode3.4 and installed. after this, i wrote gcc to spotlight. there was .kmpg files and i installed them too..

    this is the main question

    main()
    {
    printf("show my name");
    }

    in to textedit. and i saved. but now i dunno how to call it to terminal. ? file's name is "my name"
     
  5. dashcs macrumors regular

    Joined:
    Oct 2, 2009
    #5
    abbaskywalker

    Lol don't use textedit.

    Its not like notepad in windows.

    Either use Xcode or terminal (Like Vi)

    To compile in terminal
    Type
    man gcc
    You should get all your information.

    For exemple lets says i have a c program
    test.c is the file name

    What I do in terminal.
    I would type
    gcc -o test test.c

    Which complies my program with and sets the executable name.
    I would then type
    ./test

    Which loads up the program
     
  6. electroshock macrumors 6502a

    electroshock

    Joined:
    Sep 7, 2009
    #6
    Congratulations on starting your university adventures!

    I would suggest naming files without whitespaces in them if possible -- makes it easier, but if you really want white spaces in the names, you can still do that.

    If you save it as this file:

    myname.c

    Then in Terminal.app, you can compile it and run it with:

    cc myname.c -o myname
    ./myname

    P.S. You mentioned /n but I think it's actually \n
     

Share This Page