----- Original Message ----- From: Jon Gans <gans@star.physics.yale.edu> To: <roottalk@hpsalo.cern.ch> Subject: Standalone Code, scope, TControlBar > > After fixing all GUI stuff, I find the variables do not stay in scope in > the controlbar. for example, with the following code, I get this error > when the Test button is pressed: > Error: No symbol x in current scope FILE:/tmp/27101aaa_cint LINE:1 > > here is the code: There is no scope problem here. There is a problem of two C++ environments. one is created by your compiler at the compilation step another one is generated by CINT at run-time with the CINT dictionary between them. I think you should change your code as follows (but it would be better to redesign it) > > extern void InitGui(); > VoidFuncPtr_t initfuncs[] = { InitGui, 0 }; > > TROOT root("richView", "Rich Viewer",initfuncs); > > int main(int argc, char **argv) > { > > TApplication * theApp = new TApplication("RichEvent", &argc, argv); > // TRint * theApp = new TRint("RichEvent",&argc,argv,0,0); > > int x = 10; > > TControlBar bar("vertical"); char buffer[30]; sprintf(buffer,"(*((int *)(0x%x)))++;",&x); // Please check this expression mat be I miscounted the brackets. bar.AddButton("Test", buffer, "test"); instead of yours: > bar.AddButton("Test", "x++;", "test"); ===== > bar.Show(); > > theApp->Run(); > return 0; > } > > moreover, if i switch to TRint instead of TApplication i get: > undefined reference to `TRint::TRint(char *, int *, char **, void *, int)' > > I know TRint.h is included because if i comment out the include line a get > many more errors. At this point I would advice going back to the "regular" ROOT first. This may simplify your life a lot. Hope this helps, Valery > Jonathan Gans Home: 516 344 1265 > Brookhaven National Lab Work: 516 344 7405 > Building 902b, Room 11 Fax/Voice Mail: 516 213 4967 (LI) > Upton, NY 11973 (Via Email) 718 247 2926 (NYC) ================================================================= Dr. Valeri Faine (Fine) ------------------- Phone: +1 516 344 7806 Brookhaven National Laboratory FAX : +1 516 344 4206 Bldg. 510A /STAR mailto:fine@bnl.gov Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:37 MET