I thank you for your advice
now another trouble occurs when I get zhe following error
CLEAN SUCCESSFUL (total time: 455ms)
/usr/bin/make -f nbproject/Makefile-Debug.mk build/Debug/GNU-Linux-x86/main.o
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/main.o.d"
g++ -lmgl-wnd `wx-config --cxxflags` `wx-config --libs` -lmgl-fltk -lmgl-qt -lmgl-glut -c -g -I../../include -I/usr/local/include -MMD -MP -MF "build/Debug/GNU-Linux-x86/main.o.d" -o build/Debug/GNU-Linux-x86/main.o main.cpp
In file included from /usr/local/include/FL/Fl_Menu_.H:28:0,
from /usr/local/include/FL/Fl_Menu_Bar.H:25,
from /usr/include/mgl2/fltk.h:68,
from /usr/include/mgl2/window.h:24,
from main.cpp:1:
/usr/local/include/FL/Fl_Menu_Item.H: In member function ‘long int Fl_Menu_Item::argument() const’:
/usr/local/include/FL/Fl_Menu_Item.H:259:40: error: ‘fl_intptr_t’ was not declared in this scope
long argument() const {return (long)(fl_intptr_t)user_data_;}
^
/usr/local/include/FL/Fl_Menu_Item.H:259:52: error: expected ‘;’ before ‘user_data_’
long argument() const {return (long)(fl_intptr_t)user_data_;}
^
make: *** [build/Debug/GNU-Linux-x86/main.o] Error 1
nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/GNU-Linux-x86/main.o' failed
COMPILE FILE FAILED (exit value 2, total time: 2s)
when trying to compile :
#include <mgl2/window.h>
#include <mgl2/data.h>
#include <mgl2/mgl.h>
#include <mgl2/type.h>
void mgls_prepare2d(mglData *a, mglData *b=0, mglData *v=0)
{
register long i,j,n=50,m=40,i0;
if(a) a->Create(n,m); if(b) b->Create(n,m);
if(v) { v->Create(9); v->Fill(-1,1); }
float x,y;
for(i=0;i<n;i++) for(j=0;j<m;j++)
{
x = i/(n-1.); y = j/(m-1.); i0 = i+n*j;
if(a) a->a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
if(b) b->a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
}
}
void mgls_prepare2v(mglData *a, mglData *b)
{
register long i,j,n=20,m=30,i0;
if(a) a->Create(n,m); if(b) b->Create(n,m);
float x,y;
for(i=0;i<n;i++) for(j=0;j<m;j++)
{
x=i/(n-1.); y=j/(m-1.); i0 = i+n*j;
if(a) a->a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
if(b) b->a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
}
}
void mgls_prepare3v(mglData *ex, mglData *ey, mglData *ez)
{
register long i,j,k,n=10,i0;
if(!ex || !ey || !ez) return;
ex->Create(n,n,n); ey->Create(n,n,n); ez->Create(n,n,n);
float x,y,z, r1,r2;
//Chapter 2: MathGL examples 79
for(i=0;i<n;i++) for(j=0;j<n;j++) for(k=0;k<n;k++)
{
x=2*i/(n-1.)-1; y=2*j/(n-1.)-1; z=2*k/(n-1.)-1; i0 = i+n*(j+k*n);
r1 = pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5);
r2 = pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5);
ex->a[i0]=0.2*x/r1 - 0.2*x/r2;
ey->a[i0]=0.2*y/r1 - 0.2*y/r2;
ez->a[i0]=0.2*(z-0.3)/r1 - 0.2*(z+0.3)/r2;
}
}
void mgls_prepare3d(mglData *a, mglData *b=0)
{
register long i,j,k,n=61,m=50,l=40,i0;
if(a) a->Create(n,m,l); if(b) b->Create(n,m,l);
float x,y,z;
for(i=0;i<n;i++) for(j=0;j<m;j++) for(k=0;k<l;k++)
{
x=2*i/(n-1.)-1; y=2*j/(m-1.)-1; z=2*k/(l-1.)-1; i0 = i+n*(j+m*k);
if(a) a->a[i0] = -2*(x*x + y*y + z*z*z*z - z*z - 0.1);
if(b) b->a[i0] = 1-2*tanh((x+y)*(x+y));
}
}
int sample2(mglGraph *gr)
{
/*
gr->Rotate(60,40);
gr->Box();
*/
gr->SubPlot(3,2,0); gr->Title("StickPlot");
gr->StickPlot(3, 0, 20, 30); gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
gr->StickPlot(3, 1, 20, 30); gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
gr->StickPlot(3, 2, 20, 30); gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
gr->SubPlot(3,2,3,""); gr->Title("ColumnPlot");
gr->ColumnPlot(3, 0); gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
gr->ColumnPlot(3, 1); gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
gr->ColumnPlot(3, 2); gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
gr->SubPlot(3,2,4,""); gr->Title("GridPlot");
gr->GridPlot(2, 2, 0); gr->Box("r"); gr->Puts(mglPoint(0),"0","r");
gr->GridPlot(2, 2, 1); gr->Box("g"); gr->Puts(mglPoint(0),"1","g");
gr->GridPlot(2, 2, 2); gr->Box("b"); gr->Puts(mglPoint(0),"2","b");
gr->GridPlot(2, 2, 3); gr->Box("m"); gr->Puts(mglPoint(0),"3","m");
gr->SubPlot(3,2,5,""); gr->Title("InPlot"); gr->Box();
gr->InPlot(0.4, 1, 0.6, 1, true); gr->Box("r");
gr->MultiPlot(3,2,1, 2, 1,""); gr->Title("MultiPlot");
gr->Box();
return 0;
///Chapter 2: MathGL examples 7
}
int sample1(mglGraph *gr)
{
gr->SubPlot(3,2,0); gr->Title("Usual axis"); gr->Axis();
gr->SubPlot(3,2,1); gr->Title("Too big/small range");
gr->SetRanges(-1000,1000,0,0.001); gr->Axis();
gr->SubPlot(3,2,3); gr->Title("Too narrow range");
gr->SetRanges(100,100.1,10,10.01); gr->Axis();
gr->SubPlot(3,2,4); gr->Title("Disable ticks tuning");
gr->SetTuneTicks(0); gr->Axis();
gr->SubPlot(3,2,2); gr->Title("Manual ticks"); gr->SetRanges(-M_PI,M_PI, 0, 2);
float val[]={-M_PI, -M_PI/2, 0, 0.886, M_PI/2, M_PI};
//gr->SetTicksVal(’x’, mglData(6,val), "-\\pi\n-\\pi/2\n0\nx^*\n\\pi/2\n\\pi");
//gr->Axis(); gr->Grid();
gr->FPlot("2*cos(x^2)^2", "r2");
//gr->SubPlot(3,2,5); gr->Title("Time ticks"); gr->SetRange(’x’,0,3e5);
//gr->SetTicksTime(’x’,0); gr->Axis();
return 0;
}
int sample33(mglGraph *gr){
/*
y1.Modify("0.3*sin(2*pi*x)");
y2.Modify("0.5+0.3*cos(2*pi*x)");
gr->Box();
gr->Region(y1,y2,"r");
gr->Plot(y1,"k2");
gr->Plot(y2,"k2");
*/
return 0;
}
int sample4(mglGraph *gr)
{
gr->SubPlot(2,2,0,"<_"); gr->Title("Semi-log axis");
gr->SetRanges(0.01,100,-1,1); gr->SetFunc("lg(x)","");
gr->Axis(); gr->Grid("xy","g"); gr->FPlot("sin(1/x)");
gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
gr->SubPlot(2,2,1,"<_"); gr->Title("Log-log axis");
gr->SetRanges(0.01,100,0.1,100); gr->SetFunc("lg(x)","lg(y)");
gr->Axis(); gr->FPlot("sqrt(1+x^2)"); //gr->Label(’x’,"x",0);
gr->Label('y', "y = \\sqrt{1+x^2}",0);
gr->SubPlot(2,2,2,"<_"); gr->Title("Minus-log axis");
gr->SetRanges(-100,-0.01,-100,-0.1); gr->SetFunc("-lg(-x)","-lg(-y)");
gr->Axis(); gr->FPlot("-sqrt(1+x^2)");
gr->Label('x',"x",0); gr->Label('y', "y = -\\sqrt{1+x^2}",0);
gr->SubPlot(2,2,3,"<_"); gr->Title("Log-ticks");
gr->SetRanges(0.1,100,0,100); gr->SetFunc("sqrt(x)","");
gr->Axis(); gr->FPlot("x");
gr->Label('x',"x",1); gr->Label('y', "y = x",0);
return 0;
}
int sample3(mglGraph *gr)
{
gr->SetOrigin(-1,1,-1);
gr->SubPlot(2,2,0); gr->Title("Cartesian"); gr->Rotate(50,60);
gr->FPlot("2*t-1","0.5","0","r2");
gr->Axis(); gr->Grid();
gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)",0);
gr->SubPlot(2,2,1); gr->Title("Cylindrical"); gr->Rotate(50,60);
gr->FPlot("2*t-1","0.5","0","r2");
gr->Axis(); gr->Grid();
gr->SetFunc("2*y*x","y*y - x*x",0);
gr->SubPlot(2,2,2); gr->Title("Parabolic"); gr->Rotate(50,60);
gr->FPlot("2*t-1","0.5","0","r2");
gr->Axis(); gr->Grid();
gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z");
gr->SubPlot(2,2,3); gr->Title("Spiral"); gr->Rotate(50,60);
gr->FPlot("2*t-1","0.5","0","r2");
gr->Axis(); gr->Grid();
gr->SetFunc(0,0,0); // set to default Cartesian
return 0;
}
int sample5(mglGraph *gr)
{
gr->SubPlot(2,2,0); gr->Title("Colorbar out of box"); gr->Box();
gr->Colorbar("<"); gr->Colorbar(">");
gr->Colorbar("_"); gr->Colorbar("^");
gr->SubPlot(2,2,1); gr->Title("Colorbar near box"); gr->Box();
gr->Colorbar("<I"); gr->Colorbar(">I");
gr->Colorbar("_I"); gr->Colorbar("^I");
gr->SubPlot(2,2,2); gr->Title("manual colors");
mglData a,v;
mgls_prepare2d(&a,0,&v);
//Chapter 2: MathGL examples 23
gr->Box(); gr->ContD(v,a);
gr->Colorbar(v,"<"); gr->Colorbar(v,">");
gr->Colorbar(v,"_"); gr->Colorbar(v,"^");
gr->SubPlot(2,2,3); gr->Title("log-scale");
gr->SetRange('c',0.01,1e3);
gr->Colorbar(">",0.5,0); gr->Puts(mglPoint(0,1.2),"Normal scale");
gr->SetFunc("","","","lg(c)");
gr->Colorbar(">"); gr->Puts(mglPoint(1.3,1.2),"Log scale");
return 0;
}
int sample7(mglGraph *gr)
{
mglData a,b,d; mgls_prepare2v(&a,&b); d = a;
for(int i=0;i<a.nx*a.ny;i++) d.a[i] = hypot(a.a[i],b.a[i]);
mglData c; mgls_prepare3d(&c);
mglData v(10); v.Fill(-0.5,1);
gr->SubPlot(2,2,1,""); gr->Title("Flow + Dens");
gr->Flow(a,b,"br"); gr->Dens(d,"BbcyrR"); gr->Box();
gr->SubPlot(2,2,0); gr->Title("Surf + Cont"); gr->Rotate(50,60);
//Chapter 2: MathGL examples 85
gr->Light(true); gr->Surf(a); gr->Cont(a,"y"); gr->Box();
gr->SubPlot(2,2,2); gr->Title("Mesh + Cont"); gr->Rotate(50,60);
gr->Box(); gr->Mesh(a); gr->Cont(a,"_");
gr->SubPlot(2,2,3); gr->Title("Surf3 + ContF3");gr->Rotate(50,60);
gr->Box(); gr->ContF3(v,c,"z",0); gr->ContF3(v,c,"x"); gr->ContF3(v,c);
gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
gr->ContF3(v,c,"z",c.nz-1); gr->Surf3(-0.5,c);
return 0;
}
int sample8(mglGraph *gr)
{
mglData a,b; mgls_prepare2v(&a,&b);
gr->SubPlot(2,2,0,""); gr->Title("Flow plot (default)");
gr->Box(); gr->Flow(a,b);
gr->SubPlot(2,2,1,""); gr->Title("’v’ style");
gr->Box(); gr->Flow(a,b,"v");
gr->SubPlot(2,2,2,""); gr->Title("’\\#’ style");
gr->Box(); gr->Flow(a,b,"#");
mglData ex,ey,ez;
mgls_prepare3v(&ex,&ey,&ez);
//Chapter 2: MathGL examples 82
gr->SubPlot(2,2,3); gr->Title("3d variant"); gr->Rotate(50,60);
gr->Box(); gr->Flow(ex,ey,ez);
return 0;
}
int sample10(mglGraph *gr)
{
gr->Title("Surf3 plot"); gr->Rotate(50,60);
gr->Light(true); gr->Alpha(true);
//gr->Box(); gr->Surf3(c);
return 0;
}
int sample11(mglGraph *gr)
{
gr->AddLegend("sin(\\pi {x^2})","b");
gr->AddLegend("sin(\\pi x)","g*");
gr->AddLegend("sin(\\pi \\sqrt{x})","rd");
gr->AddLegend("just text"," ");
gr->AddLegend("no indent for this","");
gr->SubPlot(2,2,0,""); gr->Title("Legend (default)");
gr->Box(); gr->Legend();
gr->Legend(3,"A#");
gr->Puts(mglPoint(0.75,0.65),"Absolute position","A");
//Chapter 2: MathGL examples 28
gr->SubPlot(2,2,2,""); gr->Title("coloring"); gr->Box();
gr->Legend(0,"r#"); gr->Legend(1,"Wb#"); gr->Legend(2,"ygr#");
gr->SubPlot(2,2,3,""); gr->Title("manual position");
//------------------
gr->Title("Surf3 plot"); gr->Rotate(50,60);
gr->Light(true); gr->Alpha(true);
gr->Box(); gr->Legend(0.5,0.5);
return 0;
}
//-----------------------------------------------------
int main(int argc,char **argv)
{
//mglData yx;
mglWindow gr(sample11,"MathGL examples");
gr.FPlot("sin(pi*10*x)");
gr.WriteFrame("test.png");
return gr.Run();
} and everything was working well before so I dont understant
thank you fpr helping
from /usr/include/mgl2/window.h:24,
from main.cpp:1:
/usr/local/include/FL/Fl_Menu_Item.H: In member function ‘long int Fl_Menu_Item::argument() const’:
/usr/local/include/FL/Fl_Menu_Item.H:259:40: error: ‘fl_intptr_t’ was not declared in this scope
long argument() const {return (long)(fl_intptr_t)user_data_;}
^
/usr/local/include/FL/Fl_Menu_Item.H:259:52: error: expected ‘;’ before ‘user_data_’
long argument() const {return (long)(fl_intptr_t)user_data_;}
^
make: *** [build/Debug/GNU-Linux-x86/main.o] Error 1
nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/GNU-Linux-x86/main.o' failed
COMPILE FILE FAILED (exit value 2, total time: 2s)