Function not defined when running compiled macro

Hi,
I have some analysis code that I’ve been trying to run using the following macro:

[code]void run() {

gSystem->Load("libDelphes.so");
gSystem->CompileMacro("readers/Reconstruction_kkV2Wh.cpp","k");

Reconstruction_kkV2Wh("/Users/alexemerman/Desktop/pp2KKV2Wh/Wl1-c2-m2-s33_pp2KKV2Wh_10k.root");

}[/code]

But it is giving me an error

Processing run.C... Info in <TUnixSystem::ACLiC>: creating shared library /Users/alexemerman/Desktop/MadGraph/Delphes/readers/Reconstruction_kkV2Wh_cpp.so In file included from /Users/alexemerman/Desktop/MadGraph/Delphes/classes/DelphesClasses.h:25, from /Users/alexemerman/Desktop/MadGraph/Delphes/readers/Reconstruction_kkV2Wh.cpp:22, from /Users/alexemerman/Desktop/MadGraph/Delphes/readers/Reconstruction_kkV2Wh_cpp_ACLiC_dict.h:34, from /Users/alexemerman/Desktop/MadGraph/Delphes/readers/Reconstruction_kkV2Wh_cpp_ACLiC_dict.cxx:17: /Users/alexemerman/Desktop/MadGraph/Delphes/classes/SortableObject.h:27: warning: unused parameter ‘obj’ Error: Function Reconstruction_kkV2Wh("/Users/alexemerman/Desktop/pp2KKV2Wh/Wl1-c2-m2-s33_pp2KKV2Wh_10k.root") is not defined in current scope run.C:15: *** Interpreter error recovered ***

There is no function named Reconstruction_kkV2Wh in the cpp file, so I think the problem is that the function isn’t being added to the CINT dictionary. Do you know how to fix this?
Edit: I should add that I am running Root 5.34/07 on Mac OSX 10.6.8

Thanks,
Alex

Hi Alex,

When executing a macro, ROOT calls the method having the same name than the file name, in your case
Reconstruction_kkV2Wh(), so you should rename your main function Reconstruction_kkV2Wh() or rename your file with the name of your main function…

Cheers, Bertrand.