How to display C ++ output in Xcode output console

I read all the previous answers to similar questions, and all of them seem to relate to displaying output for a command line project. What if you want to run what Xcode calls "Empty" (a project without files, goals, or configuration builds).

The code below completes successfully. Still, the All Weekend console still does not display results. I tried to delve into the GDB documentation, but I'm new to it and I got 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's even worse is that the teacher in my C ++ class has no solution for this after 3 attempts.

+3
source share
4 answers

: Cmd + Shift + C : → → . Xcode 4.3.2.

, Xcode 3 Cmd + Shift + R ( ).

+5

, noob -, , , . , . .

xcode , .. -, ++ xcode , , , , , xcode , ( ). . , , , , .

noob, , .

+1

.

Xcode (, , ).

Xcode knows to associate I / O with the OSX / Xcode console when creating a New Project -> OS X Application Template -> and Console . (The OSX console may be the default I / O for a number of other frameworks, but apparently it is higher by default).

Another important thing (which you are already doing), as someone mentioned. Xcode does not enter the console until it sees "endl" or "\ n" .

0
source

It seems you should have "\ n" at the end of your prints. For instance:

cout << "Come up and C++ me some time.\n";

This should sort.

-2
source

All Articles