Dear experts,
I am a CMS student. I have a question about how to use the objects/classes that are defined in a library “libCondFormatsJetMETObjects.so” if I want to compile the code into an executable using g++. So far the code cannot be compiled because the compiler has no idea about the classes that are defined in the library.
The class I would like to use is called “JetCorrectorParameters”. I have a very simple testing code:
#include "TROOT.h"
#include "TSystem.h"
#include <iostream>
int main() {
std::cout << gSystem->Load("libCondFormatsJetMETObjects.so") << std::endl; // returns 1
std::cout << gROOT->GetClass("JetCorrectorParameters") << std::endl; // returns 0x4de5b20
JetCorrectorParameters par = JetCorrectorParameters("Summer19UL18_V5_MC_Uncertainty_AK4PFchs.txt","Total");
par.printScreen();
return 0;
}
And I compile the code with
g++ -Wall `root-config --cflags --libs` test.C /<PathToLib>/libCondFormatsJetMETObjects.so -o test
I can feel that it won’t work because the compiler cannot see where the classes are defined. And I would like to know how to make it work with a compiler.
Thank you,
Yao
Please read tips for efficient and successful posting and posting code
_ROOT Version:6.14/09
_Platform:bash shell
_Compiler:g++