In Debug root script
it was found that a root script can be debugged by calling it with ++g
.
root -l script.cc++g
How to format this command if I call the root script with arguments (Start root with a root file and script ):
root -l 'script.cc("opt1", "opt2")'
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
root.exe -l 'script.cc++g("opt1", "opt2")'
Is it important to add .exe
?
I work in Linux
When I call the script like that root does not recognise itself, e.g.
use of undeclared identifier 'TFile'
“root.exe” is the real executable which you want to debug (“root” is just a superfluous driver on top of it).
You seem to be missing: #include "TFile.h"
But normally it is not necessary to provide the #include
's for root classes in root scripts. Where is the difference?
compiler versus interpreter
This time the script will be compiled rather than interpreted?
You explicitly ask for it using “++g” (as you want to debug it).
Then there is an incompatibility with such statements:
R__ADD_INCLUDE_PATH($CUSTOMLIB/interface)
#include "ClassInCustomLib.hh"
The error is:
fatal error: ClassInCustomLib.hh: No such file or directory
#include "ClassInCustomLib.hh"
^
compilation terminated.
What to do?
This is a known deficiency which nobody cares about: JIRA -> ROOT -> ROOT-10104
Create a simple “rootlogon.C
” file (in the current working directory):
{
if (gSystem->Getenv("CUSTOMLIB")) {
gInterpreter->AddIncludePath(gSystem->ExpandPathName("${CUSTOMLIB}/interface"));
}
}
How do I accomodate this line:
R__ADD_LIBRARY_PATH($CUSTOMLIB/lib)
I see a lot of errors like this:
script_cc_ACLiC_dict.cxx:(.text+0x1ebf): undefined reference to somefunction(TH1*)'
and
(.text+0x20): undefined reference to
main’`
Does it mean I should rename int script()
to int main()
?
In the “rootlogon.C
” file, add:
gSystem->AddDynamicPath(gSystem->ExpandPathName("${CUSTOMLIB}/lib"));
What to do for this line:
R__LOAD_LIBRARY(libCustomLib.so)
{ // rootlogon.C
if (gSystem->Getenv("CUSTOMLIB")) {
gInterpreter->AddIncludePath(gSystem->ExpandPathName("${CUSTOMLIB}/interface"));
gSystem->AddDynamicPath(gSystem->ExpandPathName("${CUSTOMLIB}/lib"));
gSystem->Load("libCustomLib");
}
}
Does gSystem
have an equivalent of echo $LD_LIBRARY_PATH
?
system
Closed
17
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.