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

aningbo

macrumors member
Original poster
Sep 15, 2009
30
0
i just bought macbook pro and can't figure out how to start off. i found the terminal but there's not a single editor preinstalled! i'm using mac os x 10.5.7

could anyone give me a brief introduction on how to write a simple C code, compile it instruction. i can't find it anywhere! thanx.

Code:
#include <stdio.h>
main()
{
printf('hello');
}
 
i just bought macbook pro and can't figure out how to start off. i found the terminal but there's not a single editor preinstalled! i'm using mac os x 10.5.7

could anyone give me a brief introduction on how to write a simple C code, compile it instruction. i can't find it anywhere! thanx.

Code:
#include <stdio.h>
main()
{
printf('hello');
}

Install Xcode, it is on your Leopard disc. I think you can get it online as well.
 
You can use TextEdit, or just type vim in the Terminal.

Compile using terminal commands:
gcc filename.c -o name of compiled app

Run the program using
./name of compiled app

I would recommend installing the Developer Tools from your Leopard DVD, but using XCode for small "Hello World"-ish apps is a lot of extra work compared to just using a plain text editor and the terminal for compiling and running.

For a text editor, I would recommend MacVim if you plan on doing a lot of programming (has a steep learning curve, but is very efficient once you've learned all the commands), or perhaps TextWrangler. Both are free.
 
i found the terminal but there's not a single editor preinstalled!

TexTEdit, vim, emacs and pico/nano come preinstalled and I wouldn't be surprised if there are other lesser known ones preinstalled.

If you want to program on a Mac, download XCode (or install it from your OSX DVD). It will include not only the XCode IDE but the typical GNU development tools (gcc/g++, gdb, make, etc).
 
thanx guys.

really appreciate your time. i got it working with xcode available in the dvd. i was wondering as to how i would download such a huge file since m in college with proxy and 100MB limit

thanx agaiun.
 
i was wondering as to how i would download such a huge file since m in college with proxy and 100MB limit

Downloading caps are such an alien concept to me. To download updates and such you might be able to talk to your college's computer science department, or the IT department who manages your account to see if they would be willing to download the update for you and save it to a thumb-drive or other media.
 
Also, your code won't work:
Your code:
Code:
#include <stdio.h>
main()
{
  printf('hello');
}

Working code:
Code:
#include <stdio.h>
int main(int argc, char *argv[]) {
  printf("Hello\n");
  return 0;
}

Single quotes are for character literals. Passing a character literal to something expecting a char * will not turn out well for you.

As for you downloading large files... maybe you can go to a lab, download the large file to a keychain drive, etc. and go about it that way? 100MB (per day? week? month?) seems like a pretty severe restriction.

-Lee
 
thanx guys.

really appreciate your time. i got it working with xcode available in the dvd. i was wondering as to how i would download such a huge file since m in college with proxy and 100MB limit

You'll occasionally need to install large patches or major Xcode updates (100-300 MB). When you do, you may want to bum a ride, walk, or catch a bus to the town's public library if they have wireless internet and download large stuff that way then go back to school. Or a nearby Starbucks or some other establishment with uncapped wireless service and buy some drinks/food.

Also, you may want to consider getting a great book that shows screenshots and step by step for setting up Xcode projects, doing small projects and building up C and Objective-C knowledge. I like to recommend Aaron Hillegass's Cocoa Programming for MacOS X (3rd edition).
 
As for you downloading large files... maybe you can go to a lab, download the large file to a keychain drive, etc. and go about it that way? 100MB (per day? week? month?) seems like a pretty severe restriction.

-Lee

Our university had a 100MB per semester (half-year) limit before we had to use an outside provider.

It sucked.

We see all those folks in the states agonising over a 250GB monthly download cap and wish we could get anywhere near that. Biggest I've seen here is 150GB but that was mostly confined to off-peak.
 
I'm curious; do the universities then expect the students to find alternative broadband methods? Is it even possible to deploy residential broadband in the dorm room, or are students expected to fork out even more money for expensive 2G/3G connectivity?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.