Pages

Sunday, March 21, 2010

Xcode 3.2.1. gcc 4.2 stringstream.

This classical code does not work in Xcode 3.2 (gcc 4.2).
#include <iostream>
#include <sstream>
using namespace std;

int main (int argc, char * const argv[])
{
int x = 9;
stringstream ss;
ss << x;
cout << "x = " << ss.str() << endl;

return 0;
}
It happens only in the debug mode:

Program loaded.
run
[Switching to process 4719]
Running…
x = 

Debugger stopped.
Program exited with status value:0.
In release everything's fine:

Program loaded.
run
[Switching to process 4768]
Running…
x = 9

Debugger stopped.
Program exited with status value:0.


Here is an answer:
http://lists.apple.com/archives/xcode-users/2009/Oct/msg00616.html

No comments:

Post a Comment