PDA

View Full Version : Executables




Doug.Mellon
Mar 26, 2006, 08:01 PM
I am new to mac C++ programming and have a quick question... I created a simple program that I want to execute in terminal. I was wondering what file I click on to do this? I have the C++ xCode project saved on my desktop so I went in that and cant find the executable. I have tried a bunch of diffrent stuff but it keeps opening in xCode.
Any help would be awsome!
Thanks in advance,
Doug

EDIT: I was also wondering how you can get somthing to beep continusly?



NewbieNerd
Mar 26, 2006, 10:25 PM
EDIT: I was also wondering how you can get somthing to beep continusly?

Sounds like you're really making an application that is simply a joy to use... :rolleyes:

Doug.Mellon
Mar 26, 2006, 10:43 PM
hahaha... no no, that doesnt have to do with my app haha. Just wanted to know for fun.

mrichmon
Mar 26, 2006, 10:55 PM
I created a simple program that I want to execute in terminal. I was wondering what file I click on to do this?


Open the terminal, then run the executable that is in the build/Debug directory of your XCode project.


EDIT: I was also wondering how you can get somthing to beep continusly?

If this program is to be run from the terminal then a control-G character (ascii code decimal 7) will make the terminal beep. Put that into a loop:


while(0) {
printf("%c\n", 7);
}

Doug.Mellon
Mar 26, 2006, 11:38 PM
cool thanks alot for the help guys.
~ Doug

Doug.Mellon
Mar 26, 2006, 11:43 PM
ok... this may sound really dumb but hang with me. I opened terminal and went file -> open -> and it wouldnt let me open the executable... then relized i prob. had to type somthing in, in the terminal itself. If this is the case what would I type...
thanks for being patient.
~ Doug

mrichmon
Mar 27, 2006, 09:36 AM
ok... this may sound really dumb but hang with me. I opened terminal and went file -> open -> and it wouldnt let me open the executable... then relized i prob. had to type somthing in, in the terminal itself. If this is the case what would I type...
thanks for being patient.
~ Doug

I would suggest that if you don't know how to use the terminal shell then you should either first learn how to use the shell, or try to write a different type of program.

You will need to change directory to the folder in which the executable resides and then type in the name of the executable.

steelphantom
Mar 27, 2006, 12:07 PM
If you're just writing simple one-file programs, which I assume you are doing now, just code your program in a text editor (such as Smultron (http://smultron.sourceforge.net)) and then use CPP Edit (http://s13.invisionfree.com/CPP_Edit/) to compile it. I've been using this combination for a while now, since I'm only writing simple programs at the moment. Once I get into programs with additional headers and stuff I'll move over to Xcode.

Doug.Mellon
Mar 27, 2006, 12:45 PM
Cool thanks alot for the help guys...

If you're just writing simple one-file programs, which I assume you are doing now, just code your program in a text editor (such as Smultron (http://smultron.sourceforge.net)) and then use CPP Edit (http://s13.invisionfree.com/CPP_Edit/) to compile it. I've been using this combination for a while now, since I'm only writing simple programs at the moment. Once I get into programs with additional headers and stuff I'll move over to Xcode.
ill try that out.

mwpeters8182
Mar 27, 2006, 01:54 PM
The best way to learn how to code is to become familiar with the terminal, and use a simple text editor to get started.

save the file as [filename].cpp, then just use g++ -o [filename] [filename.cpp]

./filename will then run the exec.

MP