I have read all prior answers to similar questions and they all seem to pertain to displaying output for a Command Line project. What if you'd like to run as what Xcode calls a 'Empty' (project with no files, targets or build configs).
The code below builds successfully. And yet the 'All Output' console still does not show the results. I tried to go deep into the GDB documentation but I'm a newbie and I get lost in it.
Below is the code:
#include <iostream>
using namespace std;
int main()
{
cout << "Come up and C++ me some time.";
cout << endl;
cout << "You won't regret it!" << endl;
std::cout << "Press any key to continue." <<endl;
cin.get();
cin.get();
return 0;
}
What makes it worse is that the teacher of my C++ class has no solution for this after 3 attempts.
Go to Xcode → Preferences → Debugging → On Start → "Show Console".
In order to print logs, we use the NSLog method in Objective-C programming language which we have used right from the Hello World example. Now, when we compile and run the program, we will get the following result. 2013-09-16 00:32:50.888 demo[16669] Hello, World!
Try Activate Console command: Cmd+Shift+C or in the Top menu: View -> Debug Area -> Activate Console. It is true for Xcode 4.3.2.
As I remember there is a command Cmd+Shift+R (run in console) in Xcode 3.
My post may be way tardy, but if any other noob users scours the web like I did for an hour before working out the answer on their own it will be a godsend. The answer was simple but no one mentioned it. Make the window wider after activating the debug area!!!
If the xcode window is too narrow, i.e. if you have a webpage open showing a tutorial on C++ and squished the xcode window next to it like I did, and you don't see the command line output despite activating the debugger because when the window is narrow the stupid xcode hides the left half of the debugger if both the right and left panels are currently visible (as is default it seems). These can be toggled off in the upper right corner. Alternatively the bottom left corner of the debugger pane has two buttons that lets you select which half of the debugger to view, the command line portion or the other portion.
If you're a noob user like me, then this just might save you an hour headache.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With