Why simple CPlusPlus programs in XCode crash when using std::string
From Mac Guides
Do you get an error like:
malloc: *** error for object...pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug
when you run your simple C++ program that uses std::string?
Do you want it to stop?
Go to the Projects menu, choose Edit Project Settings. Click the Build tab. Set Configuration to Debug. Search for "preprocessor". Clear the "Preprocessor Macros" setting. Close the menu, try to run your program and hopefully the error goes away.
Brought to you by contributors to the Mac Programming Forum, who likely read this fix elsewhere.