Shared libraries


I have created a program called tpcdata where I am using also Root functions, and so for that I have included the Root header files as

#include “TH1.h” for example…

For compiling it I have created the following Makefile:

tpcdata: tpcdata.cxx
g++ -I/afs/ -L/afs/ -lCore -lCint
-lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lpthread -lm -ldl -rdynamic -o tpcdata tpcdata.cxx

Then I compile it and get the desired executable tpcdata.

But then when I try to run it I get the folowing error message:

tpcdata: relocation error: tpcdata: undefined symbol: _ZN8TStorage11ObjectAllocEj

It seems that maybe there are some problems with the libraries?!

If I trype ldd -r tpcdata: => /afs/ (0x00111000) => /afs/ (0x00ba7000) => /afs/ (0x00682000) => /afs/ (0x008c6000) => /afs/ (0x00ac4000) => /afs/ (0x00f12000) => /afs/ (0x00d8a000) => /afs/ (0x00e85000) => /afs/ (0x00ead000) => /afs/ (0x00fed000) => /afs/ (0x01992000) => /lib/tls/ (0x00a8b000) => /lib/ (0x00a9b000) => /usr/lib/ (0x066a1000) => /lib/tls/ (0x00ed8000) => /lib/ (0x00a9e000) => /lib/tls/ (0x08b70000)
libstdc+± => /usr/lib/libstdc+± (0x0427e000)
/lib/ => /lib/ (0x00aae000)
undefined symbol: _ZN8TStorage11ObjectAllocEj (./tpcdata)
undefined symbol: _ZN7TObjectdlEPv (./tpcdata)
undefined symbol: _ZN4TH1FC1EPKcS1_idd (./tpcdata)
undefined symbol: _ZN5TFileC1EPKcS1_S1_i (./tpcdata)

This is what I get!! Why it is trying to find the libraries in /afs/

when I explicity pointed in the Makefile to -L/afs/ ???
Is this the problem??
Thank you very much for your help…


You must have an error in your PATH and LD_LIBRARY_PATH variables


Indeed that was the problem.
I have updated the PATH and LD_LIBRARY_PATH variables, and now everything seems to work fine…

Thank you very much