In Xcode 3.2.1 on Mac OS X Snow Leopard, I open a project under: A command-line tool like C ++ stdC ++. I have the following simple code:
#include <iostream> #include <string> using namespace std; int main(){ string myvar; cout << "Enter something: " << endl; cin >> myvar; cout << endl << myvar << endl; return 0; }
The program compiles and prompts me to "Enter something." When I enter something, and then press enter, I get the following error:
myproject(766) malloc: *** error for object 0x1000041c0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Program received signal: "SIGABRT". sharedlibrary apply-load-rules all (gdb)
When compiling on an earlier version of Xcode (3.1.2) on another computer (the project opens with the option "command line utility", which does not exist in 3.2.1), the code works without NO PROBLEM.
Does anyone know what is going on? Thanks, Yuval
source share