GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » R3BRoot » General Discussions » Problem with loading TVector3 in R3BRoot (Problem with loading TVector3 in R3BRoot)
Problem with loading TVector3 in R3BRoot [message #23198] Tue, 30 October 2018 15:27 Go to next message
C. A. Douma is currently offline  C. A. Douma
Messages: 88
Registered: September 2015
Location: Groningen
continuous participant
From: *kvi-cart.rug.nl
Dear all,

I am trying to build an R3BRoot class with a TVector3 member, but when I try to use the class in
a macro, I am getting the following error:

cling::DynamicLibraryManager::loadLibrary(): /home/christiaan/Desktop/FAIR/R3BRoot_Build/lib/libTest.so.SOVERSION: undefined symbol: _ZTV8TVector3
Error in <TInterpreter::TCling::AutoLoad>: failure loading library Test.so for R3BTest

I have produced a minimal working example. The included .zip-file contains a directory Test, which
should be placed in the R3BRoot source directory. Subsequently, a command add_subdirectory(Test)
should be added to the master CMakeLists.txt near line 370 and then R3BRoot should be re-build.

Afterwards, running the macro TestClass.cpp in R3BRoot/Test/Macros/ should produce the error.
However, When I comment out lines 7 and 13 in R3BTest.cxx in R3BRoot/Test/SubDir/ the error is gone.

Can anyone explain to me what caused the error and how I can fix this?

Thanks in advance!
Christiaan Douma.
  • Attachment: Test.zip
    (Size: 2.59KB, Downloaded 254 times)
Re: Problem with loading TVector3 in R3BRoot [message #23199 is a reply to message #23198] Wed, 31 October 2018 09:28 Go to previous messageGo to next message
Dmytro Kresan is currently offline  Dmytro Kresan
Messages: 166
Registered: June 2004
first-grade participant
From: *gsi.de
TVector3 class is defined in libPhysics library of ROOT. You need to add "Physics" to the DEPENDENCIES variable inside of CMakeLists.txt.

Best regards,
Dima
Re: Problem with loading TVector3 in R3BRoot [message #23200 is a reply to message #23199] Wed, 31 October 2018 10:21 Go to previous message
Jan Mayer is currently offline  Jan Mayer
Messages: 20
Registered: August 2015
occasional visitor
From: *ikp.uni-koeln.de
I would also like to add the following:

You should not use a pointer for a member that the class owns (= is responsible for), with few exceptions.

Here, R3BTest class can simply own it naturally, like the TString one line above. Just think simple. No need to initialize and delete it, nothing can go wrong, the code is much shorter and easier to understand.

If the class needs to own a polymorphic class, there are unique and shared ptrs.
A class may include pointer members to stuff it is not responsible for.

See also https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#S-resource
Previous Topic: Changes to Detector Constructors for Simulations
Next Topic: Problems with GLAD magnetic field
Goto Forum:
  


Current Time: Sat Apr 20 00:52:02 CEST 2024

Total time taken to generate the page: 0.00812 seconds