Hi Jan,
You probably forgot to load the Physics library which contains the code and
definition for TVector3. Before loading your script do
gSystem->Load("libPhysics");
Also it is imperative that you remove the line:
gROOT->Reset();
It has the effect of unloading most of what you have done (at the CINT
level) prior to its execution. In particular, it might unload the very
script and function you are executing!!
gROOT->Reset should ONLY be used within an unamed macro.
Cheers,
Philippe
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Jan Strube
Sent: Friday, August 02, 2002 1:44 PM
To: rene.brun@cern.ch
Cc: roottalk@cern.ch; Jeffrey J. Early
Subject: [ROOT] argument passing
Hi !
I have a problem passing arguments to functions. I get errormessages of
the kind "symbol unknown not declared". I have no clue what that could
point to, because I DO NOT HAVE a symbol "unknown", so of course it is
undeclared.
Another errormessage I have a hard time understanding is something like
"symbol event not declared in current scope", although "event" is passed
as an argument to the function.
In order to reproduce this behavior, I wrote a simple script:
Int_t function_test(Int_t ntries=10) {
gROOT->Reset();
Int_t IntTest = 100;
TVector3 *testVec = new TVector3(1.2, 3.4, 5.5);
functionCall(IntTest);
calling(testVec);
return ntries;
}
Int_t functionCall(Int_t t)
{
for (int i=0; i<t; i++)
cout << "Number is " << i << " of " << t << endl;
return 2;
}
void calling(TVector3 *t2)
{
cout << "TVector3 value is: " << endl;
cout << "X: " << t2->x() << "\tY: " << t2->y() << "\tZ: " << t2->z();
cout << endl;
return;
}
I get the following errormessages:
Error: Symbol TVector3 is not defined in current scope
FILE:function_test.cc LINE:7
Error: Symbol TVector3 is not defined in
current scope FILE:function_test.cc LINE:7
Error: type TVector3 not
defined FILE:./function_test.cc LINE:7
Warning: Automatic variable TVector3*testVec allocated in global scope
FILE:function_test.cc LINE:7
Error: Undeclared variable TVector3*testVec
FILE:function_test.cc LINE:7
*** Interpreter error recovered ***
What is wrong ?
Thanks a lot in advance
Jan
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET