In Xcode 3.2.1 on Mac OS X Snow Leopard, I open a project under: Command Line Tool of type C++ stdc++. I have the following simple code:
#include
As far as I can tell, I'm not experiencing this issue in Release mode for x86_64. But I am seeing the issue in Debug x86_64. If I follow the directions given by Howard in this post, I'm able to get it running in debug mode:
_GLIBCXX_DEBUG=1 _GLIBCXX_DEBUG_PEDANTIC=1Build and run, you'll notice it works. Another interesting observation is that using __gnu_debug::string (from the header) alone does not trigger the error.
EDIT: from the horses mouth (known issues in XCode 3.2.1)
The default gcc 4.2 compiler is not compatible with the Standard C++ Library Debug Mode. C++ programs compiled with Xcode 3.2 may not work in the Debug configuration. To fix this, set the Compiler Version to 4.0, or edit the Debug configuration’s Preprocessor Macros and remove the entries:
_GLIBCXX_DEBUG=1 _GLIBCXX_DEBUG_PEDANTIC=1
You can do this for all projects by navigating to /Developer/Library/Xcode/Project Templates/Application/Command Line Tool/C++ Tool/C++Tool.xcodeproj/ and editing project.pbxproj and deleting the lines around line 138:
"_GLIBCXX_DEBUG=1",
"_GLIBCXX_DEBUG_PEDANTIC=1",