Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

why does xcode give me an error than says "exited unexpectedly lost connection" when i put in a cin>> input in c++

.

iMac, OS X Mountain Lion (10.8.5)

Posted on Oct 11, 2013 11:01 PM

Reply
Question marked as Best reply

Posted on Oct 12, 2013 7:24 AM

?

12 replies

Oct 19, 2013 10:05 AM in response to goattee

Just tried the code MrHoffman pointed to


#include <iostream>
using namespace std;


int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;


cout << "The value you entered is " << i;


cout << " and its double is " << i*2 << ".\n";


return 0;
}


Tried it in Xcode 5 on a 10.8.5 system and it ran, both in Xcode and from the command line, fine.


Are you sure your project is a C++ command line project?


User uploaded file

Oct 19, 2013 11:41 AM in response to goattee

First have you tried the program from the terminal? It works there correct?


What kind of keyboard do you have, a wireless or a full keyboard with numeric keypad? After doing a search I hove found that the problem seems to be with using the Enter key in Xcode rater then the Return key.


The full keyboard with the numeric keypad has both an Enter and Return key. The Enter key is part of the Numeric keypad the Return key is part of the alpha kneeboard. Try using the Return key.


On the wireless keyboard (which I have) normal function of the key is Return but if you hold the function it sends Enter. If I run this code in Xcode and press the function to send a Enter I get the error.


User uploaded file


In the terminal either key works fine so it is some weirdness in Xcode. Just use the Return key and you should be ok.


regards

why does xcode give me an error than says "exited unexpectedly lost connection" when i put in a cin>> input in c++

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.