Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dissolve

macrumors 6502a
Original poster
Aug 23, 2009
546
0
Ok this is probably a simple question with an answer I just can't find, but I'm having an issue with writing C++ in Xcode. Before snow leopard (in the previous version of Xcode), I could write a program, hit "build and go", the code would compile and execute in a terminal-like window. Now, the only way I can get it to execute is opening the executable in the project window. Build and run seems to compile and then do nothing.

Any way to return to the functionality I'm used to? Still pretty new to this so any help is greatly appreciated. Thanks
 
Ok this is probably a simple question with an answer I just can't find, but I'm having an issue with writing C++ in Xcode. Before snow leopard (in the previous version of Xcode), I could write a program, hit "build and go", the code would compile and execute in a terminal-like window. Now, the only way I can get it to execute is opening the executable in the project window. Build and run seems to compile and then do nothing.

Any way to return to the functionality I'm used to? Still pretty new to this so any help is greatly appreciated. Thanks

Open the Console window when you click build and run.
 
Open the Console window when you click build and run.

While that works, it seems to me to be the same as opening the executable from the organizer window. Any way for this to be automated like it was previously, in which "build and run" compiles and opens a results window?
 
While that works, it seems to me to be the same as opening the executable from the organizer window. Any way for this to be automated like it was previously, in which "build and run" compiles and opens a results window?

Yes. You need to set the option in the Preferences (the same way you had too in previous versions of Xcode).
 
Yes. You need to set the option in the Preferences (the same way you had too in previous versions of Xcode).

I must be seriously missing something because I've looked through preferences several times and cannot find any option that resembles what I'm hoping for. I didn't have to alter anything with the previous version of Xcode so that's why I'm lost here. Thanks for your help so far.
 
Go to the Debugging preferences. Choose Show Console from the On Start pop-up menu.
 
Go to the Debugging preferences. Choose Show Console from the On Start pop-up menu.

And there it is...that worked :) I swear I tried that earlier and it did nothing but all is well now. Thank you both for your help.

Another question though...is this actually executing the program as it would by opening the UNIX executable? Just curious, but why not display in a terminal window?
 
It's using a pseudo terminal for the input and output. For simple programs there shouldn't be a difference between running in Xcode and the Terminal.

As to why the input and output aren't displayed in a Terminal window, my guess is that Apple wants you to be able to do everything in Xcode. By providing the debugging console, you don't have to launch the Terminal application to perform command-line input and output.
 
It's using a pseudo terminal for the input and output. For simple programs there shouldn't be a difference between running in Xcode and the Terminal.

As to why the input and output aren't displayed in a Terminal window, my guess is that Apple wants you to be able to do everything in Xcode. By providing the debugging console, you don't have to launch the Terminal application to perform command-line input and output.

Alright, that's a fair enough interpretation. While I did prefer the old behavior, this seems to be doing the exact same thing for my purposes. I guess the executable is only a few clicks away if there's ever a reason to run that. Thank you for your help everyone.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.