I have a problem when I try to use the TSpectrum class.
I’m using cmake to compile a binary from a code that works fine, but if I declare a variable TSpectrum, I get the following error when I run the macro (cmake and make gives no errors, it compiles fine):
/cvmfs/sft.cern.ch/lcg/app/releases/ROOT/5.34.34/x86_64-cc7-gcc48-opt/root/bin/root.exe: symbol lookup error: ~/WA105_LightSoft/build/lib/libLightSoft.so: undefined symbol: _ZN9TSpectrumC1Eif
I think it may be cased by a bad definition of the libraries, but then I don’t understand why I can use all the other ROOT classes without problems (TH, TF…). I don’t know if it is a cmake or ROOT problem…
nm -C /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/5.34.34/x86_64-cc7-gcc48-opt/root/lib/libSpectrum.so |grep "TSpectrum::TSpectrum("
0000000000078e20 T TSpectrum::TSpectrum(int, float)
0000000000078bd0 T TSpectrum::TSpectrum()
0000000000078e20 T TSpectrum::TSpectrum(int, float)
0000000000078bd0 T TSpectrum::TSpectrum()
I think it just needs to be linked and LD_LIBRARY_PATH set correctly.
You’ll need to link with libSpectrum (CMake calls it Spectrum); check the CMake doc on how to add a library to the target of your library / binary. I believe it’s target_link_libraries(LightSoft Spectrum).