# Linking problem to libTree.so

**URL:** <https://root-forum.cern.ch/t/linking-problem-to-libtree-so/13697>\
**Category:** ROOT\
**Created:** [January 30, 2012, 6:23pm UTC](https://root-forum.cern.ch/t/linking-problem-to-libtree-so/13697 "2012-01-30T18:23:25Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![ajafari](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@ajafari](https://root-forum.cern.ch/u/ajafari)\
**Post date:** [January 30, 2012, 6:23pm UTC](https://root-forum.cern.ch/t/linking-problem-to-libtree-so/13697/1 "2012-01-30T18:23:25Z")

</div>

Hi all,  
I am trying to compile a code which uses the TTree class. Hence, I execut (\*) to compile and link my executable to needed libraries. But the compiler does not realize that I need “-lTree” to be linked to my .o.  
I think so because after compiling successfully, I get this (\*\*) runtime error. Besides, the “ldd” command output does not contain libTree.  
I cured it by adding gSystem-\>Load(“[libTree.so](http://libTree.so)”) in my .C file, but it is not a wise and permanent solustion.

Can somebody help me understand what is wrong with my linking?

Thanks a lot,  
Nadjieh

(\*)  
ROOTGLIBS =$(shell root-config --glibs) -lMinuit  
ROOTCFLAGS =$(shell root-config --cflags)  
LIBS = userLibs  
HEADERS = userheaders

```
@echo "Compiling the SelectAndSave .... \n"
$(CXX) SelectAndSave.C -c -o SelectAndSave.o -O0 $(ROOTCFLAGS) -fPIC $(HEADERS)
@echo "Linking ...... \n"
g++ SelectAndSave.o -o SelectAndSave $(ROOTGLIBS) -lEG $(LIBS) -v -g -fPIC -O0 -I/opt/root/include -m64 -pthread $(HEADERS)

```

(\*\*)  
Warning in TClass::TClass: no dictionary for class TTree is available  
Warning in TClass::TClass: no dictionary for class TBranchElement is available  
Warning in TClass::TClass: no dictionary for class TBranch is available  
Warning in TClass::TClass: no dictionary for class TLeafElement is available  
Warning in TClass::TClass: no dictionary for class TLeaf is available  
Warning in TClass::TClass: no dictionary for class TVirtualIndex is available  
Warning in TClass::TClass: no dictionary for class TBranchRef is available  
Error in TBufferFile::ReadClassBuffer: class: TNamed, attempting to access a wrong version: 18, object skipped at offset 63  
Error in TBufferFile::CheckByteCount: object of class TNamed read too few bytes: 2 instead of 10314  
Error in TBufferFile::ReadClassBuffer: class: TNamed, attempting to access a wrong version: 18, object skipped at offset 60  
Error in TBufferFile::CheckByteCount: object of class TNamed read too few bytes: 2 instead of 493722  
runTree:  
Error in TFile::Read: Key not found

\*\*\* Break \*\*\* segmentation violation

# =========================================================== There was a crash. This is the entire stack trace of all threads:

# #0 0x00007f25d3cc811e in waitpid () from /lib/x86\_64-linux-gnu/libc.so.6 #1 0x00007f25d3c5ee0e in ?? () from /lib/x86\_64-linux-gnu/libc.so.6 #2 0x00007f25d5c0ae37 in TUnixSystem::StackTrace() () from /opt/root/lib/libCore.so #3 0x00007f25d5c0d703 in TUnixSystem::DispatchSignals(ESignals) () from /opt/root/lib/libCore.so #4 #5 0x000000000043c6f5 in PracticalEvent::PracticalEvent(TTree\*, TTree\*, bool, bool, bool, bool, bool, bool, bool, bool) () #6 0x0000000000429fa9 in main ()

# The lines below might hint at the cause of the crash. If they do not help you then please submit a bug report at [root.cern.ch/bugs](http://root.cern.ch/bugs). Please post the ENTIRE stack trace from above as an attachment in addition to anything else that might help us fixing this issue.

# #5 0x000000000043c6f5 in PracticalEvent::PracticalEvent(TTree\*, TTree\*, bool, bool, bool, bool, bool, bool, bool, bool) () #6 0x0000000000429fa9 in main ()

---

_[View the full topic](https://root-forum.cern.ch/t/linking-problem-to-libtree-so/13697)._
