The following minimal program compiles and runs ok with g++ (osx and cygwin).
However, with XCode, it compiles ok, but it crashes at runtime:
+++++++++++++++++++++++++++++++ #include <iostream> using namespace std; #include "json/json.h"
static string test() { cout << "test.START." << endl; string s = string("hello");
// If we uncomment the following code line, Xcode crashes with this error // when executing the program: // malloc: *** error for object 0xa010e5ec: Non-aligned pointer being freed //Json::Reader reader; cout << "test.END." << endl; return s; }
int main() { cout << "main. START" << endl; test(); cout << "main. END" << endl; return 0; } +++++++++++++++++++++++++++++++
What can be the problem?
Many thanks, DAvid
Log in to post a comment.
The following minimal program compiles and runs ok with g++ (osx and cygwin).
However, with XCode, it compiles ok, but it crashes at runtime:
+++++++++++++++++++++++++++++++
#include <iostream>
using namespace std;
#include "json/json.h"
static string test() {
cout << "test.START." << endl;
string s = string("hello");
// If we uncomment the following code line, Xcode crashes with this error
// when executing the program:
// malloc: *** error for object 0xa010e5ec: Non-aligned pointer being freed
//Json::Reader reader;
cout << "test.END." << endl;
return s;
}
int main() {
cout << "main. START" << endl;
test();
cout << "main. END" << endl;
return 0;
}
+++++++++++++++++++++++++++++++
What can be the problem?
Many thanks,
DAvid