Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does mglData cause a BAD ACCESS exception?
    text
    copied!<p>I have successfully managed to install MathGL on Mac OS and managed to get the <code>mglGraph</code> to generate me the sample graphs. Yet when I try to use <code>mglData</code> to handle my data, it crashes with an "EXC_BAD_ACCESS" error. Why? Is there anything I need to do I haven't done?</p> <p>I installed mathgl with cmake, make and make install (using sudo to be on the safe side). Then I added the <em>/usr/local/include</em> and <em>/usr/local/lib</em> paths to the project and added the <em>libmgl.dylib</em> and <em>libmgl-wnd.dylib</em> references to the project. Is there anything I've missed out? I could not find anybody else with the error (well, I found many bad access errors, but none caused by mglData). The error pops up as soon as I'm trying to construct a mglData instance, so any of this triggers the exception:</p> <pre><code> mglData *data = new mglData(); mglData data; etc... </code></pre> <p><strong>EDIT</strong></p> <p>So, here's the bare bone of my code that compiles but crashes:</p> <pre><code> #include iostream #include mgl2/mgl.h int main(int argc, const char * argv[]) { mglData y; return 0; } </code></pre> <p>The thread's call stack when it crashes is:</p> <p><img src="https://i.stack.imgur.com/LWTV3.png" alt="Thread call stack"></p> <p>And the values of all variables are this:</p> <p><img src="https://i.stack.imgur.com/ESPC9.png" alt="Variable values"></p> <hr> <p><strong>Semi-Solved</strong> <em>Got it running</em></p> <p>After having been able to compile my project with g++, I tried changing the build settings and who would have believed it, I managed to get it running! All I did was change the <em>C++ Standard Library</em> to <code>libstdc++ (GNU C++ standard library)</code>. Now I'm not using the default, which is to use <code>libc++ (LLVM C++ standard library with C++ 11 support)</code>. At the moment this seems to work fine for my Cocoa application also, but I don't know for how long :P (When using more NS* Classes I worry LLVM may be necessary?)</p> <p>Still I'm very interested in how this issue can be resolved (without having to change the build settings) or whether it can't.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload