ACLiC does not load shared lib?

Hello, ROOTers

I have small macro including TVector3.

#include <TROOT.h>
#include <TSystem.h>
#include <TVector.h>
#include <TVector3.h>
void test_load() {
TVector3 *v = new TVector3();
v->SetXYZ(1., 2., 3.);

I would like to complie this macro by the follwing way,
root [0] .x test_load.cpp++
But, I got some error messages

Info in TUnixSystem::ACLiC: creating shared library ~/harufumi/./
dlopen error: ~/harufumi/./
undefined symbol: _ZN8TVector3C1Eddd
Load Error: Failed to load Dynamic link library ~/harufuumi/./
/usr/lib/crt1.o: In function _start': /usr/lib/crt1.o(.text+0x18): undefined reference tomain’
~/harufumi/./filegh51mN.o: In function test_load()': ~/harufumi/./filegh51mN.o(.text+0x97): undefined reference toTVector3::TVector3[in-charge](double, double, double)'
collect2: ld returned 1 exit status
*** Interpreter error recovered ***

If I load before compiling, it can be compiled
by above method.
root [0] gSystem->Load(“”);
root [1] .x test_load.cpp++
root [2]
(in this case, commented out gSystem->Load(“”)
in the macro.

So, Is it impossible to load shared lib in ACLiC mode when
I would like to use TVector3 object ?
In such a case, I can not include
gSystem->Load(“LibPhysics”) in my macro ?
Must I always load before compiling ?

I use ROOT v 3.10.02 on linux with gcc 3.2.3 .


For now ACLiC does not have any means of investigating the code and pre-load the needed shared library. The need to pre-load the shared library your code depend on is a requirement from the compiler/OS.

Thus you have to call gSystem->Load(“libPhysics”) before loading your library.


PS. We hope to implement a way to automatic load the needed ROOT library in the coming year.