Newbie: Getting started in C

Discussion in 'Mac Programming' started by pusman83, Jan 13, 2008.

  1. pusman83 macrumors regular

    Joined:
    May 9, 2005
    #1
    Hello,

    I'm just getting started in programming and I have to start with C. How do I get a C editor/compiler working on my Mac?

    I downloaded xCode today but I'm a bit lost... :eek:

    Thanks!
     
  2. numero macrumors regular

    Joined:
    Jul 23, 2002
    Location:
    OR
    #2
    Run the installer for Xcode if you haven't done that already.

    Since you are just starting out I am going to assume that you are either in a class or have some book to learn from. Most people start with command line programs. Here's how you get one setup.

    Run Xcode. /Developer/Applications/Xcode

    Create a new project. File / New Project

    Create a standard command line project. Open the Command Line Utility triangle and select Standard Tool.

    Give your project a name and place to be saved to.

    That's it. You are now ready to edit the main.c file.
     
  3. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #3
    Visually, here's what you pick.

    Todd
     

    Attached Files:

  4. Darkjenso macrumors regular

    Joined:
    Oct 27, 2007
    #4
    is it just me, but does the xcode documentation on the apple site for the previous version?
     
  5. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #5
    Depends which version documentation you are looking at :). Obviously the old tutorials will be based on IB 2 but there is new documentation included with Xcode 3 for all the new tools.
     
  6. pusman83 thread starter macrumors regular

    Joined:
    May 9, 2005
    #6
    Thanks! :D

    I didn't want to be coding on an old P3 laptop we have lying around...

    Can I compile to .exe from the Mac?
     
  7. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #7
    From XCode... I don't think so.

    If you have bootcamp or parallels, and have Windows installed, you could download Visual C/C++ Express for free and compile on the Windows side though.

    Todd
     
  8. harrymohan macrumors member

    Joined:
    Nov 15, 2007
    Location:
    Syracuse, New York
    #8
    when u r done writing code, do Build and then goto Terminal of Mac and goto the path where u created this file then do this
    bash>g++ filename.c
    it will compile, if the output is on console
    bash>./a.out

    u will see output on terminal
     
  9. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #9
    You can but you would need to build your own cross compiler from the GCC source.
     

Share This Page