Developer Forums relocated!

Need help with Apple Developer tools and technologies? Want to share information with other developers and Apple engineers? Visit Developer Forums at Apple.

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

10.6 Debug Compiling Problem

After installing Xcode 3.2, the 10.6 debugger gives some strange results.

I created a new project using: Application->Command Line Tool -> C++ stdc++

Pasted in the code from cplusplus.com for istringstream.

Here is the simple code :

// using istringstream constructors.
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main () {

int n,val;
string stringvalues;

stringvalues = "125 320 512 750 333";
istringstream iss (stringvalues,istringstream::in);

for (n=0; n<5; n++)
{
iss >> val;
cout << val*2 << endl;
}

return 0;
}

Console Results for: 10.6|Debug|X86_64 or i386:
0
0
0
0
0


If set to :
10.5|Release or Debug| x86_64 or i386
10.6|Release| x86_64 or i386
Console Results:

250
640
1024
1500
666

Compiling with 10.6 Debug seems to have a problem. I tried doing a clean install of SL 10.6 and clean install of Xcode 3.2, but get same results.

Any suggestions?

17" Macbook pro (late 2007)

Posted on Sep 18, 2009 1:21 PM

Reply
6 replies

Sep 18, 2009 4:55 PM in response to Paulo Rodriguez

Someone in another thread has already filed a bug about this, but your example was so sweet that I just couldn't resist filing another. I edited your code just a bit to simply and clearly show the bug:

#include <iostream>
#include <sstream>
#include <string>
#ifdef GLIBCXXDEBUG
#define GLIBCXX_DEBUGDEFINED "1"
#else
#define GLIBCXX_DEBUGDEFINED "<undefined>"
#endif
int main()
{
std::string svalue("42");
std::istringstream in(svalue);
int value;

in >> value;

std::cout << "Original value was: " << svalue << std::endl;

std::cout
<< "With GLIBCXXDEBUG="
<< GLIBCXX_DEBUGDEFINED
<< " value is "
<< value << std::endl;
return 0;
}

Try running with default debug and release settings. Then try debug bug without these macros.

My bug will certainly be rejected as a duplicate.

I am beginning to take a perverse pleasure in filing 10.6 bugs.

But this is a very important plot point - in 10.6 you must remove the macros " GLIBCXXDEBUG=1 GLIBCXX_DEBUGPEDANTIC=1".

10.6 Debug Compiling Problem

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