Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pusman83

macrumors regular
Original poster
May 9, 2005
101
0
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!
 

numero

macrumors regular
Jul 23, 2002
106
3
OR
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.
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Visually, here's what you pick.

Todd
 

Attachments

  • XcodeScreenSnapz001.png
    XcodeScreenSnapz001.png
    73.1 KB · Views: 113

Darkjenso

macrumors regular
Oct 27, 2007
114
0
is it just me, but does the xcode documentation on the apple site for the previous version?
 

pusman83

macrumors regular
Original poster
May 9, 2005
101
0
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?
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
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
 

harrymohan

macrumors member
Nov 15, 2007
46
0
Syracuse, New York
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.