RE: [ROOT] argument passing

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Aug 02 2002 - 21:41:48 MEST


Hi Jan,

CINT's report that t2 is not defined because since it did not know about
TVector3, it did NOT defined t2.

I tried your script with gSystem->Load("libPhysics") and remove the
gROOT->Reset and have had no problem.

Cheers,
Philippe.

PS. If a CINT is too obscure, it is recommended to use ACLiC to get a better
message from the compiler.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Jan Strube
Sent: Friday, August 02, 2002 2:16 PM
To: roottalk@cern.ch
Cc: rene.brun@cern.ch; Jeffrey J. Early
Subject: RE: [ROOT] argument passing


Thank you Philippe,
your eMail clarified some things, but now I still get the error

 Error: Symbol t2 is not defined in current scope FILE:function_test.cc
LINE:24 Error: Failed to evaluate t2->x()Possible candidates are...
filename line:size busy function type and name
Error: << Illegal operator for pointer 3 FILE:function_test.cc LINE:24
Error: << Illegal operator for pointer 3 FILE:function_test.cc LINE:24
(const int)0

Why is t2 not defined ???

cheers
	Jan

------------------------------------
Jan F. Strube
Department of Physics /
Center for High Energy Physics

University of Oregon
office: WIL 412
phone: (541) 346 - 0066

On Fri, 2 Aug 2002, Philippe Canal wrote:

> 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