Basic C programming with Xcode

Discussion in 'Mac Programming' started by ilyaclark, Nov 2, 2009.

  1. ilyaclark macrumors newbie

    Nov 2, 2009
    I'm learning C in university and need to create a simple program for an assignment. I've searched all over for a compiler like codeblocks or dev C++ to be able to test my work on my macbook. I installed Xcode but I cannot figure out how to simply create a blank file, write up a simple block of C code, compile it and run it. Please advise me on how I can do this... Thx.
  2. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    What version?

    On 3.2, new project, choose application on the left, command line tool on the top right, C from the type dropdown.

    If it's really a simple assignment, i'd stick to a text editor and gcc, though.

  3. SatyMahajan macrumors regular

    Apr 26, 2009
    Cambridge, MA
    1. Launch XCode. (I'm assuming you have 3.2.1)
    2. File > New Project (or off of the welcome screen)
    3. On the left where it says Mac OS X, select Application
    4. On the right pane, select Command Line Tool
    5. Underneath the icons, where it says "Type" make sure C is selected
    6. Click Choose...
    7. Name your project
    8. Select main.c, enter your code
    9. Click Build and Run
    10. Open the Console (via Run > Console) to see the output of the program.

    Good luck!
  4. ilyaclark thread starter macrumors newbie

    Nov 2, 2009
    10. Open the Console (via Run > Console) to see the output of the program.

    That solves it!!

    Thank you very much ByteOfApple!!

Share This Page