Problem with simple unnamed script

ROOT Version: 6.10/08
Scientific Linux release 7.4 (Nitrogen),gcc version 7.2.0 (GCC)


Hello!

I’m trying to run the simple script:

{
std::cout<<“test”<<std::endl;
gROOT->ProcessLine(“.L events.C+”);
gSystem->Load(“libDDG4.so”);
gSystem->Load(“libDDG4Plugins.so”);
resp = new events();
resp->Loop();
}

The output is:

[shtol@stark01 MUMUTRON]$ root -l run_evt.C
root [0]
Processing run_evt.C…
/gcf/stark/home/shtol/MUMUTRON/./run_evt.C:7:15: error: unknown type name ‘events’
resp = new events();
^
/gcf/stark/home/shtol/MUMUTRON/./run_evt.C:8:3: error: use of undeclared identifier ‘resp’
resp->Loop();

Even first (test) line is not run.

But if I comment two last lines:

{
std::cout<<“test”<<std::endl;
gROOT->ProcessLine(“.L events.C+”);
gSystem->Load(“libDDG4.so”);
gSystem->Load(“libDDG4Plugins.so”);
// resp = new events();
//resp->Loop();
}

All is OK:

[shtol@stark01 MUMUTRON]$ root -l run_evt.C
root [0]
Processing run_evt.C…
test
root [1] resp = new events();
root [2] resp->Loop();
10 entries

So last two lines can be processed manually. What is the problem with line where I’m creating an object? Commenting only the last line doesn’t help.

Thanks.

Try:

{
  gSystem->Load(“libDDG4.so”);
  gSystem->Load(“libDDG4Plugins.so”);
  gROOT->LoadMacro("events.C++");
  gROOT->ProcessLine("events *resp = new events(); resp->Loop();");
}

Thanks! It helps to put “events *resp = new events();” in ProcessLine:

{
std::cout<<“test”<<std::endl;
gROOT->ProcessLine(“.L events_test.C+”);
gSystem->Load(“libDDG4.so”);
gSystem->Load(“libDDG4Plugins.so”);
gROOT->ProcessLine(“resp = new events()”);
resp->Loop();
}

works!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.