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?