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

ilyaclark

macrumors newbie
Original poster
Nov 2, 2009
2
0
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.
 
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.

-Lee
 
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!
 
10. Open the Console (via Run > Console) to see the output of the program.

That solves it!!

Thank you very much ByteOfApple!!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.