Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > A way to compile small C programs

A way to compile small C programs
Thread Tools
Registered User
Join Date: Jan 2001
Location: new brunswick, nj
Status: Offline
Reply With Quote
May 18, 2002, 12:18 AM
 
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
Reply With Quote
May 18, 2002, 12:38 AM
 
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
Reply With Quote
May 18, 2002, 02:21 AM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:01 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2