Home | Next
Computers really only understand ones and zeroes. Since it would be rather unwieldy to write your programs using only ones and zeroes, there are programming languages like C which are a more memorable text representation of a program, usually referred to as source code.
To write a program, one needs a text editor, and to translate this text representation of a program into actual ones and zeroes that the computer can run directly, we need a compiler. On the Mac, you usually use a program called Xcode, which is a text editor that integrates a compiler called "GCC". Xcode comes with every copy of Mac OS X as part of the Xcode Tools installer in the "Optional Installs" on one of the system discs. Simply double-click the installer and follow the instructions.
Occasionally, Apple releases new versions of Xcode. To get these, go to Apple's Developer web site and sign up for a free Apple Developer Connection Online account. Once you log in using that account, you can find new versions of Xcode on your Downloads page.
Once you have installed Xcode, you can find the Xcode application and a number of files and helper programs it relies on in the "Developer" folder at the top level of your hard disk. Xcode itself is in the "Applications" folder inside "Developer".
Home | Next
michael writes: The PDFs link to a website and ask for a Password rather than going to the next PDF
|
Uli Kusterer replies: ★ michael, you're right, seems I didn't fix up the links when generating the PDFs. Will be a bit involved to do that, though, so not sure when I'll be able to fix that.
|
David writes: Great tutorial on C. Memory allocation and use of pointers are clearly explained. Good for those who already know computer programming, either on C or other languages.
|
Sanjay Shukla writes: I found the content on this site a great guide to someone learning C on MAC using Xcode and is a beginner.
I have one question?
Can we have multiple program under one project (main.c , say another sub1.c )? And still abl to complie and run all of them at one go? How does this work?
Thanks & Regards
|
Uli Kusterer replies: ★ Sanjay, we'll later get to having one project made up of several files.
If you really meant create several programs as the final output (but this is a fairly advanced topic that won't be covered in this tutorial), Xcode has "Targets" which can be used to create different programs with one project.
You can also have several projects and then establish "dependencies" between them, by dragging one project's icon into another project's "Groups and Files" list, which will then make it show up in the "Dependencies" section of your Target's "Info" window.
Generally, Targets are used for variants of the same code (e.g. if you have a framework, and a command line tool that both do the same thing) and separate projects are used for actual different programs.
|
College student writes: X code is awesome. I recently used it to program with the java language and it worked great! Now I will attempt to learn C with it.
|
Efel writes: Hi!
I use a Mac OS X 10.4.11, I searched for Xcode in the finder, but it didn't find anything, then I downloaded it from the Apple website, but the installer wouldn't open the file (Xcode.mpkg). Does anyone have any idea why?
Thanks!
|
Uli Kusterer replies: ★ Efel, you need the right version of Xcode for your system version. If you still have your Mac OS X install CDs, there should be a folder with "additional installers" or something like that on it, containg an Xcode installer that will work on your OS X version. Alternately, log in at http://connect.apple.com (if you don't have an ADC login, get one, it's free) and check out the Downloads section, I think if you scroll down you can find older Xcode versions there as well.
|
Joshua Muniandy writes: Hi, are there tools for me to write & compile the app on a Win or Linux machine? I am a total noob in C programming and will want to learn to develop for iphone apps (was a programmer way back many many years).
|
Uli Kusterer replies: ★ Yeah. Look for GCC (The GNU compiler Collection) and any IDE (Integrated Development Environment) or text editor. Sadly, your choice depends a lot on what Linux distribution and window manager you're using and similar things. I'm a Mac user, so I'm not really up to speed with all the different Linuxes out there, but maybe this will help you find the right one. |