Library compilation error

Dear all,

I am trying to compile a C++ program calling root libraries. In the past it compiled with no problem, but now I have  a more recent ubuntu version (15.10) and a more recent root version (6.06/00) and when I run the makefile, I get:

test.c:290:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/usr/bin/gcc root-config --glibs -lm -nostartfiles -g test.o -o test
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000401a70
test.o: In function process_TTree(TFile*)': test.c:(.text+0xa7): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0xc7): undefined reference to TCanvas::TCanvas(char const*, char const*, int, int)' test.c:(.text+0xd1): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0xf1): undefined reference to TCanvas::TCanvas(char const*, char const*, int, int)' test.c:(.text+0xfb): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x11b): undefined reference to TCanvas::TCanvas(char const*, char const*, int, int)' test.c:(.text+0x125): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x145): undefined reference to TCanvas::TCanvas(char const*, char const*, int, int)' test.c:(.text+0x173): undefined reference totypeinfo for int’
test.c:(.text+0x17b): undefined reference to TClass::GetClass(std::type_info const&, bool, bool)' test.c:(.text+0x1bb): undefined reference totypeinfo for int’
test.c:(.text+0x1c0): undefined reference to TClass::GetClass(std::type_info const&, bool, bool)' test.c:(.text+0x200): undefined reference totypeinfo for int’
test.c:(.text+0x205): undefined reference to TClass::GetClass(std::type_info const&, bool, bool)' test.c:(.text+0x243): undefined reference totypeinfo for int’
test.c:(.text+0x248): undefined reference to TClass::GetClass(std::type_info const&, bool, bool)' test.c:(.text+0x298): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x2be): undefined reference to TH1D::TH1D(char const*, char const*, int, double, double)' test.c:(.text+0x2c8): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x2ee): undefined reference to TH1D::TH1D(char const*, char const*, int, double, double)' test.c:(.text+0x2f8): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x31e): undefined reference to TH1D::TH1D(char const*, char const*, int, double, double)' test.c:(.text+0x328): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x34e): undefined reference to TH1D::TH1D(char const*, char const*, int, double, double)' test.c:(.text+0x372): undefined reference toTNamed::SetTitle(char const*)’
test.c:(.text+0x399): undefined reference to TNamed::SetTitle(char const*)' test.c:(.text+0x3be): undefined reference toTNamed::SetTitle(char const*)’
test.c:(.text+0x3e6): undefined reference to TNamed::SetTitle(char const*)' test.c:(.text+0x40c): undefined reference toTNamed::SetTitle(char const*)’
test.o:test.c:(.text+0x435): more undefined references to TNamed::SetTitle(char const*)' follow test.o: In functionprocess_TTree(TFile*)’:
test.c:(.text+0x690): undefined reference to typeinfo for int' test.c:(.text+0x699): undefined reference toTDataType::GetType(std::type_info const&)’
test.c:(.text+0x6aa): undefined reference to typeinfo for int' test.c:(.text+0x6b3): undefined reference toTDataType::GetType(std::type_info const&)’
test.c:(.text+0x6c4): undefined reference to typeinfo for int' test.c:(.text+0x6cd): undefined reference toTDataType::GetType(std::type_info const&)’
test.c:(.text+0x6de): undefined reference to typeinfo for int' test.c:(.text+0x6e7): undefined reference toTDataType::GetType(std::type_info const&)’
test.c:(.text+0x703): undefined reference to TObject::operator delete(void*)' test.c:(.text+0x716): undefined reference toTObject::operator delete(void*)’
test.c:(.text+0x729): undefined reference to TObject::operator delete(void*)' test.c:(.text+0x73c): undefined reference toTObject::operator delete(void*)’
test.c:(.text+0x751): undefined reference to TObject::operator delete(void*)' test.o:test.c:(.text+0x766): more undefined references toTObject::operator delete(void*)’ follow
test.o: In function run(char const*, char const*, char const*)': test.c:(.text+0x7da): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x7fc): undefined reference to TFile::TFile(char const*, char const*, char const*, int)' test.c:(.text+0x8f4): undefined reference toTStorage::ObjectAlloc(unsigned long)’
test.c:(.text+0x913): undefined reference to TTree::TTree(char const*, char const*, int)' test.c:(.text+0x930): undefined reference toTTree::Branch(char const*, void*, char const*, int)’
test.c:(.text+0xc95): undefined reference to TObject::operator delete(void*)' test.c:(.text+0xcaf): undefined reference toTObject::operator delete(void*)’
test.o: In function TCanvasImp::IsA() const': test.c:(.text._ZNK10TCanvasImp3IsAEv[_ZNK10TCanvasImp3IsAEv]+0x1): undefined reference toTCanvasImp::Class()’
test.o: In function TCanvasImp::ShowMembers(TMemberInspector&) const': test.c:(.text._ZNK10TCanvasImp11ShowMembersER16TMemberInspector[_ZNK10TCanvasImp11ShowMembersER16TMemberInspector]+0xd): undefined reference toTCanvasImp::Class()’
test.c:(.text._ZNK10TCanvasImp11ShowMembersER16TMemberInspector[_ZNK10TCanvasImp11ShowMembersER16TMemberInspector]+0x21): undefined reference to ROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)' test.o: In functionTCanvasImp::~TCanvasImp()’:
test.c:(.text._ZN10TCanvasImpD0Ev[_ZN10TCanvasImpD5Ev]+0x1): undefined reference to operator delete(void*)' test.o: In functionTApplicationImp::ShowMembers(TMemberInspector&) const’:
test.c:(.text._ZNK15TApplicationImp11ShowMembersER16TMemberInspector[_ZNK15TApplicationImp11ShowMembersER16TMemberInspector]+0xd): undefined reference to TApplicationImp::Class()' test.c:(.text._ZNK15TApplicationImp11ShowMembersER16TMemberInspector[_ZNK15TApplicationImp11ShowMembersER16TMemberInspector]+0x21): undefined reference toROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)’
test.o: In function TApplicationImp::IsA() const': test.c:(.text._ZNK15TApplicationImp3IsAEv[_ZNK15TApplicationImp3IsAEv]+0x1): undefined reference toTApplicationImp::Class()’
test.o: In function _GLOBAL__sub_I__Z9swapbytesPti': test.c:(.text.startup+0xa): undefined reference tostd::ios_base::Init::Init()’
test.c:(.text.startup+0x14): undefined reference to std::ios_base::Init::~Init()' test.c:(.text.startup+0x19): undefined reference to__dso_handle’
test.c:(.text.startup+0x31): undefined reference to TVersionCheck::TVersionCheck(int)' test.o: In functionTH1::SetXTitle(char const*)’:
test.c:(.text._ZN3TH19SetXTitleEPKc[_ZN3TH19SetXTitleEPKc]+0x5): undefined reference to TNamed::SetTitle(char const*)' test.o: In functionTH1::SetYTitle(char const*)’:
test.c:(.text._ZN3TH19SetYTitleEPKc[_ZN3TH19SetYTitleEPKc]+0x8): undefined reference to TNamed::SetTitle(char const*)' test.o: In functionTApplicationImp::~TApplicationImp()’:
test.c:(.text._ZN15TApplicationImpD2Ev[_ZN15TApplicationImpD5Ev]+0xc): undefined reference to TString::~TString()' test.o: In functionTApplicationImp::~TApplicationImp()’:
test.c:(.text._ZN15TApplicationImpD0Ev[_ZN15TApplicationImpD5Ev]+0x10): undefined reference to TString::~TString()' test.c:(.text._ZN15TApplicationImpD0Ev[_ZN15TApplicationImpD5Ev]+0x19): undefined reference tooperator delete(void*)’
test.o:(.rodata._ZTI15TApplicationImp[_ZTI15TApplicationImp]+0x0): undefined reference to vtable for __cxxabiv1::__class_type_info' test.o:(.rodata._ZTI10TCanvasImp[_ZTI10TCanvasImp]+0x0): undefined reference tovtable for __cxxabiv1::__class_type_info’
test.o:(.rodata._ZTV15TApplicationImp[_ZTV15TApplicationImp]+0x80): undefined reference to TApplicationImp::Streamer(TBuffer&)' test.o:(.rodata._ZTV10TCanvasImp[_ZTV10TCanvasImp]+0x100): undefined reference toTCanvasImp::Streamer(TBuffer&)’
test.o:(.eh_frame+0x40b): undefined reference to __gxx_personality_v0' /usr/bin/ld: test: hidden symbol__dso_handle’ isn’t defined
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
: recipe for target ‘test’ failed
make: *** [test] Error 1

In attachment are my C++ program and my Makefile.
Could anyone tell me how to change my Makefile, please?
test.c (8.17 KB)
Makefile.txt (501 Bytes)

Hi Franciscus,
Ubuntu version 15 comes with GCC 5.x with the new ABI that we are not yet supporting. The symptoms are missing symbols an link time. To be sure, which compiler are you using? and how did you install ROOT 6.06.00?

Hello,

I am using

g++ --version
g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright © 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And I installed ROOT from source.

Thanks a lot,
regards,
Francesca

Try instead installing ROOT following this instructions (downgrading first gcc):