This discussion is archived
2432 Views 18 Replies Latest reply: Jul 12, 2008 4:45 PM by Alonso Delarte
It depends on what you're trying to do.
If you're trying to create a mac application with buttons and slides and whistles, you run xcode, create a project and work from there.
If you're just trying to write a program that will spit out the first 100 primes or something, (hello world, 100 bottles of beer on the wall, whatever) then I'd recommend picking an editor (vi, emacs, pico, textedit, whatever) coding up a file that ends in .c and saving it. (say foo.c)
Then you go to the Terminal (under utilities) at the terminal you cd to where your file is (probably: cd Documents) and type gcc -o foo foo.c
that will create an executable called foo which you can run by typing foo at the next prompt.
I'm not sure what your or C knowledge is, so if that was at the wrong level, I'm sorryMac Mini, Mac OS X (10.5.1)
The best way to install gcc is to install the developer tools from Apple. Even if you don't want to use Xcode or the other tools it will install gcc and make all the necessary arrangements for it to work.
If you want to use gcc to compile your C from the command line then use Terminal to gain access to the command line and use just about any C tutorial that is designed for Unix. A capable text editor like TextWrangler will be a big help eventually as well.
Here's an OS X specific tutorial: http://cocoadevcentral.com/articles/000081.php
This site has a lot of good tutorials for the beginner on it.
Hope that helps,
=TodG5/2.0x2, Dual XServes x2, XRAID, beige G3 501Mhz
Well im not sure what I want to do.. I got this book called The C Programming Language Second edition cuz someone i know told me C is an excellent start to programming. I have a little experience in doing Java.. and I like HATE IT... So Id like to learn like C in general.. eventually id like to make apps for mac but i figure Id use cocoa with objective C for that.. for now I just want to learn C and i wasnt sure how to go about it.. but my friend told me GCC is goodMacBook, Mac OS X (10.4.10)
Install the Developer Tools, then follow [this|http://discussions.apple.com/thread.jspa?messageID=6753372] to get started.Mac Pro 2x3GHz Dual, Mac OS X (10.5.2), BootCamp WinXP, LinkSys WRT54G, iPhone, AppleTV
I have a little experience in doing Java.. and I like HATE IT...
What don't you like about Java. I'm not trying to start a Java-bashing thread, I just want to find out what kinds of programming you would like to do. There are lots of languages, architectures, and paradigms to choose from.
So Id like to learn like C in general..
While C and Java are very different beasts, there are some other critters that you might like better. I wrote C and C++ for 15 years, but I wouldn't touch them today. I use Perl and Objective-C/Cocoa now and I love it.
What do you really want to get out of it? What kinds of software do you want to write?MacBook, Mac OS X (10.5.2), 1.83Ghz/2GB Ram/160 HD et al.
I dont mean to bash Java either.. but with what I have experienced with it.. I really dont like it and I find it confusing.. In terms of what I want to do with C? I really dont know.. Im in college right now a freshman.. and I want to become a software developer eventually.. maybe even for apple! So I guess I want to develop software apps? I dont wanna do things like hardware drivers or bios or stuff like that...MacBook, Mac OS X (10.4.10)
The odds of C being less confusing than java are slim, in my opinion... they basically have the same syntax. Java has more complicated data structures, but to a beginner, they look pretty much the same...
Having taught both, I can say that Java is easier to teach, without a question, but YMMV.Mac Mini, Mac OS X (10.5.1)
C is a procedural language, Java is an object oriented language. They require two different mind sets. For todays world and especially for Apple, I would recommend the object oriented mind set. Especially since you stated that you were interested in application level and not system level programming.Mac Pro 2x3GHz Dual, Mac OS X (10.5.2), BootCamp WinXP, LinkSys WRT54G, iPhone, AppleTV
That is true.. but from what I was told C is a great start and that I can use it to migrate into Objective C, and Cocoa with Objective C which are object oriented... and plus it cant hurt me to know a procedural language eh? I originally did Cocoa with Objective C so I got stuck.. so I figured id go down to the bare bones.. C since ObJ C is an extension of C.MacBook, Mac OS X (10.4.10)
Pedagogically speaking, C is a horrible language. It's like learning how to cut your food with the sharpest knife in the drawer. You give a sharp knife to a 4 year old, and you're going to get blood.
C is the same. it's very easy to do something dangerous, and stupid. Java is to a large extent a duller blade.
Java lets you shoot yourself in the foot.
C hands you the gun and helps you aim.
C++ hands you a bazooka aims it, and says "Please PLEASE blow off your own leg."Mac Mini, Mac OS X (10.5.1)
Omg i want the bazooka! Lol.. anyway.. i really wanna just get eventually into Cocoa with Objective C unless theres some other Object Oriented Lang that I would want to get into.. I just need a starting point.. and I honestly dont like Java.. its too confusing for me I understood C and Cocoa more when I did them.MacBook, Mac OS X (10.4.10)
I think your book (which is the C book to have, by the way) combined with Brian's instructions on how to use GCC in the Terminal, should be good to get you started. That book isn't going to teach you how to do anything dangerous and would be a good knowledge to have. So I think you are on the right track. I apologize if I've started an unproductive tangent.MacBook, Mac OS X (10.5.2), 1.83Ghz/2GB Ram/160 HD et al.