Reputation: 655
I am learning MathGL, a C++ library, but I find myself cannot draw a graph on the screen even using the "example code" they provided, although I can successfully draw a graph to file. The "sample codes" on their official website is as below:
#include <mgl2/window.h>
int sample(mglGraph *gr)
{
gr->Rotate(60,40);
gr->Box();
return 0;
}
//-----------------------------------------------------
int main(int argc,char **argv)
{
mglWindow gr(sample,"MathGL examples");
return gr.Run();
}
I compile this code as:
g++ test.cpp -o test.o -lmgl-wnd
as the developers suggest. This piece of code can be compiled successfully, but nothing happened when I execute the "test.o". Anyone knows where I am going wrong?
Upvotes: 2
Views: 3538
Reputation: 56
I think that you might have installed the MathGL library "without gsl and HDF5 Support"(Win32 LGPL). I had the same problem, too. And then, I found that Win32 LGPL does not support "wrapper widget classes"(which "mglWindow" is from, I think, see http://mathgl.sourceforge.net/web_en/web_en_1.html#Main). So when I installed the one "with gsl and HDF5 Support"(Win32 GPL, Of course with the gsl library installed, the gsl installation takes about 1 hour), and it succeeds.
Upvotes: 4