 |
 |
A way to compile small C programs
|
 |
|
 |
|
Registered User
Join Date: Jan 2001
Location: new brunswick, nj
Status:
Offline
|
|
I just bought "Teach Yourself C" and want to run the small programs that they supply as exercises. I started reading the tutorials in the developer section of my imac, but I'm wondering if there a quick way to input an application and run it to see the results.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Originally posted by benschilke:
<STRONG>I just bought "Teach Yourself C" and want to run the small programs that they supply as exercises. I started reading the tutorials in the developer section of my imac, but I'm wondering if there a quick way to input an application and run it to see the results.</STRONG>
Sure thing. Just fire up a terminal (located in /Applications/Utilities), type "pico cSourceFile.c", enter in the code, save using ctrl-O and exit the text editor by doing a ctrl-X, then compile using "gcc -o cCompiledCode cSourceFile.c", then execute it by typing "./cCompiledCode". It's that simple!
F-bacher
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Oct 2000
Status:
Offline
|
|
Originally posted by Ghoser777:
<STRONG>
Sure thing. Just fire up a terminal (located in /Applications/Utilities), type "pico cSourceFile.c", enter in the code, save using ctrl-O and exit the text editor by doing a ctrl-X, then compile using "gcc -o cCompiledCode cSourceFile.c", then execute it by typing "./cCompiledCode". It's that simple!
F-bacher</STRONG>
Compile using "cc -o cCompiledCode cSourceFile.c" on your Mac. (Ghoser777 is correct, but Apple calls the "gcc" compiler "cc".) If your computer doesn't like that, type "where is cc" in the Terminal. If you don't get the reply "usr/bin/cc" you'll need to install the Developers' Tools.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |