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

toddius

macrumors newbie
Original poster
Nov 2, 2011
2
0
Hi everyone,

I am trying to learn some programming basics. I am watching the Harvard CS 50 course posted here and just started reading an Absolute Beginner's Guide to C by Greg Perry. Perry's chapter one directive is to get a C Compiler. So I guess I have a couple questions for the forum:

(1) What compiler should I get that will work with a Mac? I noticed that X Code 4 is free if you have the developer membership (I don't - should I get one?). I also noticed that it would also be free if I had the Mac App Store (I don't). I have Mac OS X Version 10.5.8. If the advice is to pay for the developer membership - which one should I get? Will X Code 4 even work on my version of Mac OS X?

also,

(2) What else should I be doing in an effort to learn more about how to program?

A logical follow up question might be - for what purpose do I want to learn how to program? I don't know. I just want to learn. I do not have a technical background (liberal arts to law school to unsatisfied lawyer) but I'm a good learner.

Thanks in advance for the help/advice!

Todd
 
(1) What compiler should I get that will work with a Mac? I noticed that X Code 4 is free if you have the developer membership (I don't - should I get one?). I also noticed that it would also be free if I had the Mac App Store (I don't). I have Mac OS X Version 10.5.8. If the advice is to pay for the developer membership - which one should I get? Will X Code 4 even work on my version of Mac OS X?

XCode 3 will be on the Mac OS X 10.5 DVD. XCode 4 requires a minimum of Mac OS X 10.6.
 
you don't need a paid developer membership to download XCode for free. You only need to pay if you want the ability to distribute through the app store. Create a free account and then download XCode. Once you install XCode you will have the gnu compiler toolchain and clang available from the command line. You can use gcc as you follow along your book and learn C. For the simple programs you'll run as you go through the book I would compile and run everything from the command line and not bother with the XCode IDE.
 
Thank you

very much for the replies. I registered as a developer. My version of Mac OS X is just 10.5.8, though, and both X Code 3 and 4 apparently require 10.6.6 or higher. I guess I need to change my software? Or should I try to find X Code 2?

Thanks again for the help. I really appreciate it.

Todd
 
very much for the replies. I registered as a developer. My version of Mac OS X is just 10.5.8, though, and both X Code 3 and 4 apparently require 10.6.6 or higher. I guess I need to change my software? Or should I try to find X Code 2?

Thanks again for the help. I really appreciate it.

Todd

If you have the DVD that presumably came with your machine, you can install the devtools from that.
 
very much for the replies. I registered as a developer. My version of Mac OS X is just 10.5.8, though, and both X Code 3 and 4 apparently require 10.6.6 or higher. I guess I need to change my software? Or should I try to find X Code 2?

Thanks again for the help. I really appreciate it.

Todd

Only XCode 3.2 required Snow Leopard. You need XCode 3.1.4.

You can get XCode 3.1.4 by going into the Mac Dev Centre, then going into Additional Download, and then search for xcode 3.1
 
(1) What compiler should I get that will work with a Mac? I noticed that X Code 4 is free if you have the developer membership (I don't - should I get one?). I also noticed that it would also be free if I had the Mac App Store (I don't). I have Mac OS X Version 10.5.8. If the advice is to pay for the developer membership - which one should I get? Will X Code 4 even work on my version of Mac OS X?

Look more careful on Apple's website for the _free_ ADC membership. And there are older versions of XCode on their website, which are again a bit harder to find, but they are there (Look for "Downloads"). I think XCode 3.1 is what you want.
 
For only 5 dollars you can get the newest XCode. If you are just trying it out, I would just install the newest free one. If you have Lion you can get it from the App Store. XCode is a great IDE, it much simpler than VS but still feels like a polished product.
 
I would ditch the Greg Perry book and get something else. K&R or 'Practical C Programming' (O'reilly) for just plain C, or the new Big Nerd Ranch book on Objective-C (the first 1/3rd of the book is an intro to C)
 
Just to get you started , here is how you write a simple program once you have Xcode/g++/gcc installed.

1. Go to terminal.
2. Create a file 'hello.c' and copy paste the following code

#include <stdio.h>
int main()
{

printf("Hello Macrumors\n");

return 0;
}

3. Then save the file.
4. Type 'gcc hello.c' (w/o the quotes) to compile the program you wrote
5. Then type './a.out' (w/o the quotes) to run the program :)

Start writing small programs to learn faster.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.