|
|
#1 |
|
MAC newbie: how to write "hello world" in C
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');
}
|
|
|
|
0
|
|
|
#2 | |
|
Quote:
__________________
'07 MacBook Pro 15" 2.4GHz - '09 Mac Mini 2.53GHz - '09 iPhone 3GS 32GB - '10 iPad WIFI + 3G 64GB |
||
|
|
0
|
|
|
#3 |
|
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.
__________________
Bob Last edited by Dale Cooper; Sep 16, 2009 at 06:12 AM. |
|
|
|
0
|
|
|
#4 | |
|
Quote:
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). |
||
|
|
0
|
|
|
#5 |
|
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. |
|
|
|
0
|
|
|
#6 |
|
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.
|
|
|
|
0
|
|
|
#7 |
|
Also, your code won't work:
Your code: Code:
#include <stdio.h>
main()
{
printf('hello');
}
Code:
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello\n");
return 0;
}
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 |
|
|
|
0
|
|
|
#8 |
|
Good stuff here also:
http://developer.apple.com/mac/library/navigation/ http://developer.apple.com/mac/libra.../qt_intro.html (Note that you are using a previous version of OS X and Xcode ... versus what you will find on the Apple site, which is on the Snow Leopard distribution; as to what is different, it depends which aspect you are looking at, although most major concepts are the same; Xcode UI differs somewhat). Last edited by WildCowboy; Sep 16, 2009 at 03:46 PM. Reason: post merge |
|
|
|
0
|
|
|
#9 | |
|
Quote:
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). |
||
|
|
0
|
|
|
#10 | |
|
Quote:
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.
__________________
This is going straight to the Pool Room |
||
|
|
0
|
|
|
#11 |
|
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?
|
|
|
|
0
|
|
|
#12 |
|
100 MEG cap?
Man, a good YouTube video or two would suck that back without any difficulty.
__________________
. |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: How to get PCSX2 to run on Mac (without BootCamp) | Mirrors | Mac Applications and Mac App Store | 22 | Jun 14, 2013 08:19 PM |
| How to convinc my parents to let me buy a 17" MacBook pro | Ulf1103 | Buying Tips and Advice | 55 | Feb 20, 2012 08:11 AM |
| How to supercharge Mini? | ranny2 | Mac mini | 18 | Oct 27, 2011 08:53 PM |
| Does anybody know how to get TweetTask? | xmelissaxmayhem | Jailbreaks and iOS Hacks | 3 | Jul 3, 2011 01:21 AM |
| [HOW TO] DIY iPhone 4 Swivel Car Mount | QuarterSwede | iPhone Accessories | 13 | Mar 8, 2011 02:51 PM |
All times are GMT -5. The time now is 06:09 PM.







Linear Mode

