image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old June 22nd, 2003, 12:21 AM
ApeintheShell's Avatar
Registered User
 
Join Date: May 2002
Location: CO
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
ApeintheShell is on a distinguished road
Unhappy Can't you C ?

A just found a good C primer book in our basement.
I've read the intro and it says i need a editor and compiler.
I tried doing some coding in text edit but it doesn't save right.
Apparently i can compile in unix, not so sure. But i need a text editor.

1) Will pico be able to save my files with the .c extension?

2) or should i install the developer tools that came with 10.2?
__________________
1.66 ghz Intel Core Duo Mac Mini w/ Mac OS X 10.5.1,
400 mhz Power PC G3 iMac w/ Mac OS X 10.4.11,iPod Touch 16gb, Maxtor 80gb HD, Lacie 500gb and 250gb HD, 4th-generation 20gb iPod.
Reply With Quote
  #2  
Old June 22nd, 2003, 01:21 AM
bootedbear's Avatar
JavaJunkie
 
Join Date: Jul 2002
Location: Austin, TX
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
bootedbear is on a distinguished road
You can use any editor to create .c files that will write out files in plain text format (be sure to tell TextEdit to use plain text rather that RTF).

pico will work just fine if you want to work with a Terminal editor.

hth,
bear
Reply With Quote
  #3  
Old June 22nd, 2003, 01:30 AM
ApeintheShell's Avatar
Registered User
 
Join Date: May 2002
Location: CO
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
ApeintheShell is on a distinguished road
alright i used pico to create a file called monkey.c
it asks how many monkeys you have..haha
i used cc monkey.c to compile it and i end up with a.out in the home directory.
how do i get the monkey questionaire to run?
__________________
1.66 ghz Intel Core Duo Mac Mini w/ Mac OS X 10.5.1,
400 mhz Power PC G3 iMac w/ Mac OS X 10.4.11,iPod Touch 16gb, Maxtor 80gb HD, Lacie 500gb and 250gb HD, 4th-generation 20gb iPod.
Reply With Quote
  #4  
Old June 22nd, 2003, 03:26 AM
alone together
 
Join Date: Jul 2002
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
paracord is on a distinguished road
./a.out
__________________
A true friend stabs you in the front.
Reply With Quote
  #5  
Old June 22nd, 2003, 05:31 PM
bootedbear's Avatar
JavaJunkie
 
Join Date: Jul 2002
Location: Austin, TX
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
bootedbear is on a distinguished road
You should just be able to type 'a.out'. Under any unix shell, you simply reference an executable file to cause it to run. This is true of shell scripts as well as compiled programs.

Caveat is: the file must have executable permission. The cc compiler should have marked the file as such, but if not

chmod a+x a.out

should do the trick.

hth,
bear
Reply With Quote
  #6  
Old June 24th, 2003, 05:58 AM
slur's Avatar
Geek / Hedonist
 
Join Date: Dec 2000
Location: Florence, MA
Posts: 542
Thanks: 0
Thanked 0 Times in 0 Posts
slur is on a distinguished road
(As paracord points out, you need to enter ./a.out because the executable probably isn't in the shell's search path. This presumes the "current directory" is the location of a.out. If not then cd folder/containing/a.out)
__________________
|
| slur was here
|

check out my creative music software
Reply With Quote
  #7  
Old June 25th, 2003, 04:22 PM
Registered User
 
Join Date: Apr 2003
Location: Glasgow, Scotland
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
willmac is on a distinguished road
Compiling files as a.out all the time gets annoying. Try using the following,

monkey.c -o newname

Where "newname" is the title you want for the compiled file. You could also try typing "man gcc" in the terminal to get more info on this.

Also, to prevent having to issue the full path (or to have to use ./) everytime you want to execute you're new app, try the following. Add a "bin" folder to you're home directory and then include the path to it in you're .tcshrc file (i.e /Users/yourname/bin [where "yourname" is you're user name]). Do a search on how to create the .tcshrc file - there is plenty of info around, but if you want some help give me a shout

Below is part of my .tcshrc file so that you can see what I mean (note this should be all on one line).

setenv PATH /Users/will/bin:/usr/X11R6/bin:/opt/local/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Will
Reply With Quote
Reply

Thread Tools

Posting 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 Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 11:31 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.