Forums | MacLife
You are not logged in.
#1 2008-01-15 1:47 am
basic question about programming in C
I wrote a simple hello world program in C with TextEdit. Saved it as a text file (not RTF) and used .c as the file extension. Then went over to the Terminal to compile and run it. I typed in cc hello.c and the error that I got told me that cc was a bad command. Why? I thought that's what you did to compile a program in Terminal. What am I doing wrong? Is there a development pack that I didn't install somewhere along the way?
FYI, it's a brand new 13" MacBook running Leopard.
Offline
#3 2008-01-15 3:15 am
Re: basic question about programming in C
Just FYI, TextEdit is a horrible program to edit code in. I suggest using Vim, emacs, or XCode (once you install it) to edit your code, since they will all provide syntax highlighting and extra features to help when you're writing code. You can also install a graphical version of Vim at (http://macvim.org/). There are other programs you can try, some are free, some are not. If you're going to make any projects with multiple source files, I would recommend XCode since it's a full featured IDE.
Offline
#4 2008-01-15 5:06 am
Re: basic question about programming in C
Syntax colouring is for wimps. Green on black, that's where it's at!
,xtG
.tsooJ
Offline
#5 2008-01-15 5:38 am
Re: basic question about programming in C
Miles wrote:
Yeah, you need to install the Xcode tools. I'm not sure where they are on computers now; they used to be in /Applications/Installers/
Ah, thanks! I'll check out my install disc when I get home.
And yeah, I'm not going to use TextEdit for anything. I'm starting a C class today and just wanted to give the MacBook a try with a simple hello world program.
Thanks for the info!
Offline
#6 2008-01-15 7:36 am
- Booksley
- Planely insane!
- From: Toronto, Ontario
- Registered: 2001-02-16
- Posts: 4788
Re: basic question about programming in C
TextMate destroys all other text editors! 
Everyone has their own text editors that they like; find one, and stick with it.
Offline
#7 2008-01-24 7:06 pm
- Light Speed
- Doubter of Einstein

- Registered: 2002-08-17
- Posts: 3693
Re: basic question about programming in C
akb825 wrote:
You can also install a graphical version of Vim at (http://macvim.org/).
Didn't know about this version. Thanks!
And yeah green on black makes me happy too 
Offline

