Problem when compiling macro in ROOT

When I am compiling a macro in ROOT by this way:

root [0] gSystem->Load("actarsim.sl");
root [1] .L analysisMacro.C+

it gives the following errors:

Info in <TUnixSystem::ACLiC>: creating shared library /home/actar/ActarSim/./analysisMacro_C.so
/home/actar/ActarSim/./analysisMacro.C: In function ‘void analizeEvents(char*, char*, char*, Int_t, Int_t)’:
/home/actar/ActarSim/./analysisMacro.C:126: error: ‘ActarSimData’ was not declared in this scope
/home/actar/ActarSim/./analysisMacro.C:126: error: ‘theData’ was not declared in this scope
/home/actar/ActarSim/./analysisMacro.C:127: error: ‘ActarSimBeamInfo’ was not declared in this scope
/home/actar/ActarSim/./analysisMacro.C:127: error: ‘beamInfo’ was not declared in this scope

However, all these classes, such as “ActarSimBeamInfo” are already included in the library file “actarsim.sl”. Why ROOT says that these classes are not declared?

It will give the same errors even if I put the "gSystem->Load(“actarsim.sl”);"
inside this macro file.

Thanks!

Pang

In your analysismacro.C file, do you have the includes declaring the missing classes?

Rene

Thank you for your reply.

I didn’t put the “includes”. When I added these “includes”, it does not complain about the declaration of these classes anymore, but report another error:

root [2] .L analysisMacro.C+
dlopen error: /home/actar/ActarSim/./analysisMacro_C.so: undefined symbol: _ZN11sciGeometry11ShowMembersER16TMemberInspectorPc
Load Error: Failed to load Dynamic link library 
/home/actar/ActarSim/./analysisMacro_C.so
*** Interpreter error recovered ***

I guess now the problem is not in ROOT but in my macro.

It means that your macro is using a library that you should load before executing the macro

Rene