New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

UNIX C Compile Error


Post Reply New Thread Subscribe

 
Thread Tools
Zach_C
Guest
 
Posts: n/a

Sorry to ask on such a simple question, I'm new to UNIX and Macs although I am enjoying my switch from Windows. Here is my problem. Whenever I right a program in C++ or C I can not get it to run. Here is everything I do. I write the code in pico and save it in the appropriate file format in this case pawn.c. I can see the file in Apple's finder and it has a big C on it so I am assuming I did not mess up here. I then run Terminal and change to the appropriate directory hit ls to make sure and finally compile by typing cc pawn.c -o pawn

It all seems to go well. I go right back to the terminal prompt Zach [], but when I type pawn I get a bad command. So I looked at it in finder and it is just the standard white piece of paper icon and does not have a file extension when I go to get info.

Excuse my ignorance or references to Windows machines but shouldn't it be a .exe? Am I messing up in compiling. I checked online tutorials and they say to do it the way I did but my attempt was in vain. Any help is greatly appreciated.
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac Specs: 2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi

rman is offline
Check the directory where you compiled the program. You should find a file call pawn, as you said. To execute the file just enter at the prompt the following: ./pawn. That is dot slash pawn
QUOTE Thanks
plunger
Guest
 
Posts: n/a

congrats on your switch! I am not much of a c programmer but I do spend a good bit of time on the command line of unix/linux machines. A few things to keep in mind:

->neither unix nor OS X could care less about a .exe extension...you could call the file little.willie_is_evil and unix wouldn't care as long as you have execute permission over the file.

->from the command line: ls -al
->this will show you all of the files in your current directory and their respective permissions and ownership.

->from the command line: man chmod
-> this will tell you more about changing ownership and permissions
-> you will probably want to do something like: chmod u+x ./pawn or chmod 711 ./pawn


-> once you have execut permissions (-rwxr--r-- or something like it) then you can just follow rman's advice and enter from the command line: ./pawn

-good luck!

-P
QUOTE Thanks
Graphite

 
Graphite's Avatar
 
Member Since: Feb 25, 2003
Location: Tropical Island, Jealous?
Posts: 5,279
Graphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud ofGraphite has much to be proud of
Mac Specs: MacPro 3.0Ghz 16GB RAM, 4x256 Vid, 30''cinema display

Graphite is offline
try out apple developer tools, and write your program in there. I hvn't had a problem with it aside from me screwing up a path or other error caused by me.
QUOTE Thanks

Post Reply New Thread Subscribe


« MySQL Logging. . . | MAC Performance Monitoring »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
HELP! Catalog B-tree error, can't delete a HUGE preference file markpetrowsky Running Windows (or anything else) on your Mac 5 03-12-2004 11:39 AM
error code -43 gimmi OS X - Operating System 3 03-03-2004 05:59 PM
Upgrading PERL Forum Setup, MySQL, etc. ssotti OS X - Development and Darwin 0 11-29-2003 11:16 AM
Apple in Court over UNIX Name schweb Apple Rumors and Reports 8 06-13-2003 10:54 PM

All times are GMT -4. The time now is 03:30 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?