After upgrading to Xcode 3.2 and Snow Leopard, my debug builds are broken and fail at runtime. Stringstreams do not seem to work. They work in Release mode.
I\'ve
This is now a known and reported bug in the compiler. The only workarounds are:
Remove the flags as you suggested. This is okay, but those flags are very useful at times, and you don't want to remove them from projects and after the bug is fixed go back and update them again!
Execute in release mode for testing until you really need the debugger symbols and then temporarily remove the flags.
I have opted for #2 so that when the fix comes out, but projects are not missing the flags. For more information see:
Apple Discussions
BTW, the code the that I had that had this problem was just this simple:
#include <iostream>
#include <string>
using namespace std;
int main() {
string firstName;
string lastName;
int age;
char gender;
cout << "Enter First Name: " << endl;
cin >> firstName; // <----- error happens right here
cout << "Enter Last Name: ";
cin >> lastName;
cout << "Enter age: ";
cin >> age;
cout << "Enter gender: (m or f) ";
cin >> gender;
cout << firstName << lastName << age << gender;
return 0;
}
STL debug mode is not supported in gcc 4.2 at this time. You can use gcc 4.0 with STL debug mode, or remove the debug mode preprocessor macros from your Debug configuration and keep using gcc 4.2.
Do not forget to configure each target if you have many (I had this problem) since the projet build config does not overwrite the target build config.
I really envoy finally finding out to fix this, I was using an XP VirtualMachine and Studio 2005 to avoid this problem!