Symbol tree is not defined in current scope

Hello,
I have problem withe tree. I am runing ROOT version 4.04/02 on SLC3. Everything during and after comlile looked ok, but when I start:
root [1] tree->StartViewer()

int shows me:
Error: Symbol tree is not defined in current scope FILE:(tmpfile) LINE:1
Error: Failed to evaluate tree->StartViewer()Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered ***
my paths are:
export ROOTSYS=/cern/root
export PATH=$PATH:$ROOTSYS/bin:$CERN_ROOT/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib

I instaled ROOT in another computer by the same way and it works well, and I tryed to compile older version 4.03.02 in this computer and it didn’t help . So I don’t know where is the problem.
Does anybody know?
Cheers
Peter

Hi,

what is “tree”? Where does it come from? How did you define it? Why do you expect ROOT to know what “tree” is? Could you send us the first line of your input (root [0]…), so we can understand why Cint doesn’t know “tree”?

Cheers, Axel.

Actualy, the problem is somewhere else. I used .x staff.C, and tree->StartViewer() didn’t work. So I had to write by hand TTree *tree = new TTree(“T”,“staff data from ascii file”); and after it works. But when I want to quit ROOT it shows me:

*** Break *** segmentation violation
Generating stack trace…
0x00ac84d5 in TClass::SetUnloaded() + 0x2d from /cern/root/lib/libCore.so
0x00a9f484 in ROOT::RemoveClass(char const*) + 0x64 from /cern/root/lib/libCore.so
0x00acff0f in ROOT::TDefaultInitBehavior::Unregister(char const*) const + 0x1b from /cern/root/lib/libCore.so
0x00acf86f in ROOT::TGenericClassInfo::~TGenericClassInfo() + 0x4b from /cern/root/lib/libCore.so
0x04e9a2fa in from /cern/root/lib/libGui.so
0x025536d3 in exit + 0x63 from /lib/tls/libc.so.6
0x00b4f4fc in TUnixSystem::Exit(int, bool) + 0xa0 from /cern/root/lib/libCore.so
0x005dd4fc in TRint::Terminate(int) + 0xde from /cern/root/lib/libRint.so
0x00a13fa0 in TApplication::ProcessLine(char const*, bool, int*) + 0x166 from /cern/root/lib/libCore.so
0x005dd2e9 in TRint::HandleTermInput() + 0x1dd from /cern/root/lib/libRint.so
0x005dc0ce in TTermInputHandler::Notify() + 0x24 from /cern/root/lib/libRint.so
0x005ddb9e in TTermInputHandler::ReadNotify() + 0x12 from /cern/root/lib/libRint.so
0x00b4e005 in TUnixSystem::CheckDescriptors() + 0x143 from /cern/root/lib/libCore.so
0x00b4cefb in TUnixSystem::DispatchOneEvent(bool) + 0x151 from /cern/root/lib/libCore.so
0x00a7c774 in TSystem::InnerLoop() + 0x18 from /cern/root/lib/libCore.so
0x00a7c719 in TSystem::Run() + 0x6f from /cern/root/lib/libCore.so
0x00a14f86 in TApplication::Run(bool) + 0x32 from /cern/root/lib/libCore.so
0x005dcde4 in TRint::Run(bool) + 0x3b2 from /cern/root/lib/libRint.so
0x080488dd in main + 0x71 from /cern/root/bin/root.exe
0x0253e79d in __libc_start_main + 0xed from /lib/tls/libc.so.6
0x080487e1 in _Unwind_Resume + 0x31 from /cern/root/bin/root.exe
Root >
*** Break *** keyboard interrupt FILE: LINE:0

The same is for my GEANT4 simulations. I am using trees for analyzing data, but during compilation it shows me:
/home/mikes/geant4/geant4.7.0.p01/tmp/Linux-g++/exampleN03/exe/exampleN03.o(.text+0x300): In function main': : undefined reference toExN03EventAction::ExN03EventAction(TTree*, hit*)'
collect2: ld returned 1 exit status
make: *** [/home/mikes/geant4/geant4.7.0.p01/bin/Linux-g++/exampleN03] Error 1
I don’t thing that the problem is in my GEANT code, because it works well in another computer’s ROOT instalation.
Cheers
Peter

Hi Peter,
let’s try to separate the different problems here. I still cannot reproduce the problem of your original posting. If what you did is

.x staff.C tree->StartViewer()
then the error message soesn’t surprise me: tree is only defined in staff.C, not at the root prompt.

Next one, the stack trace when quitting root. Do you have an example macro reproducing this? It’s a strange, very root-“internal” error (i.e. it’s pretty hard to make that happen with user code), so my assumptions are:

  • you have your own TClass* / dictionary code which deosn’t work,
  • memory corruption (you’re writing to some memory space where you should not) or
  • a mismatch in compiler versions or libraries. For now, I’d try to re-build root, making sure that ROOTSYS, PATH, and LD_LIBRARY_PATH point to the correct version, and using the exact same compiler as you will use later on, when compiling your own code (i.e. .L myMacro.C+).

Though probably not very useful, you could send the output of GDB, e.g. what is the parameter for ROOT::RemoveClass(char const*)?

Now the last problem: it’s very likely an issue with your code. Even if it compiles on another computer - maybe they have different compiler versions, of maybe the code really is not the same. Did you implement the method ExN03EventAction::ExN03EventAction(TTree*, hit*)? Depending on your compiler this message might also appear because you did not implement the first virtual function of ExN03EventAction. Can you send us some code so we can try to reprocue this issue?

Cheers, Axel.