Hi
I have root macro run_test.C:
void run_test() {
TString macro_file="test.C+g";
Info("run_test","Loading main macro='%s'... ",macro_file.Data());
if (gROOT->LoadMacro(macro_file))
Fatal("run_test","Can't load macro='%s'",macro_file.Data());
test();
} // run_test
which load&runs other macro test.C:
#include <TError.h>
int test() {
Info("test","Hello, world!");
return 0;
} // test
It runs without problem in ROOT5:
[shitov@nu76-78 tmp]$ root -l
root [0] .x run_test.C
Info in <run_test>: Loading main macro='test.C+g'...
Info in <TUnixSystem::ACLiC>: creating shared library /usr/local_soft/danss/itep_analysis_2017/tmp/./test_C.so
Info in <test>: Hello, world!
root [1]
But in ROOT6 I have:
root [0] .x run_test.C
In file included from input_line_8:1:
/usr/local_soft/danss/itep_analysis_2017/tmp/run_test.C:9:3: error: use of undeclared identifier 'test'
test();
^
root [1]
Addition of function declaration in run_test.C:
int test();
doesn’t help a lot:
root [1] .x run_test.C
IncrementalExecutor::executeFunction: symbol '_Z4testv' unresolved while linking [cling interface function]!
You are probably missing the definition of test()
Maybe you need to load the corresponding shared library?
How can I run my code in ROOT6?
Thanks,
Yuri