The code fragment you presented works fine in my environment (i.e. you might have strip it down too much).
[quote]But I got an error and I don’t know how to solve this problem[/quote]What error did you get?
In addition, calling gSystem->Load from your function is unlikely to be what you need. Instead might want to try:root [] gSystem->Load("libMathCore");
root [] .L test.C+Cheers,
Philippe
error: no matching function for call to `TSystem::Load()’
/cern/root-5.12.00e/root/include/TSystem.h:377: note: candidates are: virtual int TSystem::Load(const char*, const char*, Bool_t)
I know that I can use the gSystem from the command line, but I want to avoid this .