Re: [ROOT] problems compiling -- undefined references

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 09 2003 - 22:01:54 MEST


Hi Chris,

Your Makefile contains illegal statements (+SELF,IF=LINUX,  IF=IBMRT, 
etc). In case you use Patchy or cmz, you have to extract the Makefile
for a selected platform.

You can compile directly your class in a portable way by doing:
  g++ -c Platforms.cxx `root-config --cflags`

or directly generate an executable with
  g++ -o run.exe Plattforms.cxx `root-config --cflags --glibs`

where root-config is a small utility in $ROOTSYS/bin that knows the
right compiler/linker sequence for your machine.

Rene Brun

On 
Wed, 9 Jul 2003, Chris Hayward wrote:

> Hello all,
> I'm trying to compile a program I have written and tested using ROOT. I am
> using g++ to compile. I first tried modifying the Makefile provided by the
> ROOT team, but I get the error messages:
> 
> Makefile:32: *** missing separator.  Stop.
> 
> So, I tried using just the command:
> 
> g++ Platforms.cxx
> 
> but I get many undefined references, though I've included all the proper
> libraries. Here are the errors:
> 
> /tmp/cc8ouf7p.o(.text+0x42): undefined reference to `TFile::TFile(char
> const *, char const *, char const *, int)'
> /tmp/cc8ouf7p.o(.text+0x60): undefined reference to `TObject::operator
> delete(void *)'
> /tmp/cc8ouf7p.o(.text+0xe5): undefined reference to `TObject::operator
> delete(void *)'
> /tmp/cc8ouf7p.o: In function `ReadChamber(char const *, TTree *)':
> /tmp/cc8ouf7p.o(.text+0x16f): undefined reference to `TObject::operator
> delete(void *)'
> /tmp/cc8ouf7p.o(.text+0x34c): undefined reference to `Form(char const
> *,...)'
> /tmp/cc8ouf7p.o(.text+0x6ff): undefined reference to `TObject::operator
> delete(void *)'
> /tmp/cc8ouf7p.o: In function `__static_initialization_and_destruction_0':
> /tmp/cc8ouf7p.o(.text+0xe22): undefined reference to
> `ROOT::GenerateInitInstance(Chamber const *)'
> /tmp/cc8ouf7p.o(.text+0xe2d): undefined reference to
> `ROOT::TGenericClassInfo::SetImplFile(char const *, int)'
> /tmp/cc8ouf7p.o: In function `TObject::operator new(unsigned int)':
> /tmp/cc8ouf7p.o(.gnu.linkonce.t.__nw__7TObjectUi+0xe): undefined reference
> to `TStorage::ObjectAlloc(unsigned int)'
> /tmp/cc8ouf7p.o: In function `Chamber::Chamber(void)':
> /tmp/cc8ouf7p.o(.Chamber::gnu.linkonce.t.(void)+0x10): undefined reference
> to `TObject::TObject(void)'
> /tmp/cc8ouf7p.o(.Chamber::gnu.linkonce.t.(void)+0x1d): undefined reference
> to `Chamber virtual table'
> 
> 
> I am attaching the Makefile, and below are my include statements. Please
> help me understand how to compile code that uses ROOT libraries.
> 
> Thanks,
> Chris
> 
> #include <iostream.h>
> #include <fstream.h>
> #include <string.h>
> #include <stdio.h>
> #include <stdlib.h>
> 
> #include </afs/cern.ch/sw/root/v3.05.05/rh73_gcc296/root/include/TCint.h>
> #include </afs/cern.ch/sw/root/v3.05.05/rh73_gcc296/root/include/TObject.h>
> #include </afs/cern.ch/sw/root/v3.05.05/rh73_gcc296/root/include/TTree.h>
> #include </afs/cern.ch/sw/root/v3.05.05/rh73_gcc296/root/include/TFile.h>
> 
> #include </afs/cern.ch/user/x/xtomo/chris/Chamber.cxx>
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET