Error loading shared libraries, cannot open object file

I am compiling ROOT with a Makefile and I have run some problems.

First, I believe I need to add a linker to use the vector container.

I did this following the instructions at the bottom of this page: … s-rootcint
with a Linkdef.h which contains
#pragma link C++ class vector+;

After I tried compiling with the modified makefile, I got the message:
relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC

After adding the option -fPIC into my make file, it the code compiled.

However, when I run the code, I get the message:
./test: error while loading shared libraries: reader.o: cannot open shared object file: No such file or directory

Does anybody know the solution to this problem?

Was ALL your source code compiled AND LINKED with “-fPIC”?
In particular, was the “reader.o” compiled this way?
Did you add the “reader.o” object file to the linking stage explicitly?
Or does this object file reside in a shared library?
If yes, is the path to the subdirectory where this shared library resides in your “LD_LIBRARY_PATH” environment variable?

Ah, adding to LD_LIBRARY_PATH did the trick. The code runs now (although it seg faults, probably due to another dictionary error…)