p.s. this is the linkdef file I used: PlotMeLinkDef.h: #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class PlotMe; #endif On Wed, 17 Apr 2002, Paul Dixon wrote: > Hi, > > (I've attached my small source code and makefile, hope no one minds - just > type gmake -f Makefile PlotMe to compile under linux). > > I'm still having trouble with creating a button that can access a method > via SetCommand... > > I've followed the instructions and created the dictionary files in order > to get CINT to "know" about my class, but when I run the program, I get > the following: > > root [0] gSystem.Load("libPlotMe.so") > > (int)0 > > root [1] .L canvasgui.cc > > Error in <TApplication::TApplication>: only one instance of TApplication > allowed > > root [2] main() > > <click on PlotMe button> > > Error: Symbol gPlotMe is not defined in current scope > FILE:/tmp/filevuBTUe_cint > > LINE:1 > > Error: Failed to evaluate gPlotMe->DoPlot(c)Possible candidates are... > > filename line:size busy function type and name > > *** Interpreter error recovered *** > > I've exhausted my current knowledge... can anyone point me in the right > direction? > > Cheers, > Paul > > > On 12 Apr 2002, Fons Rademakers wrote: > > > Hi Paul, > > > > SetCommand() can only be used to call methods that are know to the > > CINT interpreter. That means that you need to export PlotGraph() to CINT > > via the rootcint procedure. Also c is not directly known in the > > interpreter if the global symbol has not been exported. Please check the > > user guide on how all this can simply be done. > > > > Cheers, Fons. > > > > > > > > On Thu, 2002-04-11 at 13:44, Paul Dixon wrote: > > > Hi, > > > > > > I'm trying to build a trivial GUI so that when I click on different > > > buttons, different plots are generated. My first go is to have a button > > > that plots the example sin(x)/x. > > > > > > >From some code posted earlier on roottalk: > > > > > > I have a button defined (b) that acts as a quit button: > > > > > > TGButton *b = new TGTextButton(&mf, "Quit"); > > > b->SetCommand("gApplication->Terminate()"); > > > > > > which works fine. > > > > > > but if I change this to run my PlotGraph function: > > > > > > b->SetCommand("PlotGraph()"); > > > > > > where PlotGraph is: > > > > > > void PlotGraph(void){ > > > TCanvas *c1 = c->GetCanvas(); > > > TF1 f1("func1", "sin(x)/x", 0, 10); > > > f1.Draw(); > > > c1->Update(); > > > } > > > > > > *c is defined before main{} as > > > > > > TRootEmbeddedCanvas *c = new TRootEmbeddedCanvas("Canvas", &mf, 600, 400); > > > > > > which I believed made c global (therefore accessable from any other > > > function)... > > > > > > When I compile the code and run it, I get: > > > > > > [] ~/root $ ./canvasgui > > > Error: Function PlotGraph() is not defined in current scope > > > FILE:/tmp/filezX8DtE_cint LINE:1 > > > > > > Which has me (a c++ newbie) stumped. Presumably I've missed out some > > > important step... > > > > > > Thanks in advance, > > > Paul > -- Paul ------------------------------------------------------------------------------- Dr Paul Dixon Email: paul.dixon@surfability.com Surfability Limited Phone: 020 7074 0085 4/14 Tabernacle Street Fax : 020 7074 0086 London, EC2A 4LU URL : http://www.surfability.com -------------------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:50 MET