Root dosen't like my Undefined Constructor

I had a working root code simAnal_cxx and added a new module to it and now it complies but gives the complaint afterwards.

dlopen error: /home/osenbaug/MaGe/analysis/ undefined symbol: _ZN11ClusterDataC1Ev
Load Error: Failed to load Dynamic link library /home/osenbaug/MaGe/analysis/

An nm check on the object file finds that indeed,_ZN11ClusterDataC1, which is the symbol associated with the constructer for my new class is undefined, see

nm|grep Cluster
U _ZN11ClusterData10InitializeEv
U _ZN11ClusterData7SetSeedEffff
00002550 W _ZN11ClusterData8GetSeedXEv
000059c2 t _ZN11ClusterData8GetSeedXEv.A
0000a22c d _ZN11ClusterData8GetSeedXEv.A$$LSDA
000059b8 t _ZN11ClusterData8GetSeedXEv.J
0000a228 d _ZN11ClusterData8GetSeedXEv.J$$LSDA
00002598 W _ZN11ClusterData8GetSeedYEv
000059fa t _ZN11ClusterData8GetSeedYEv.A
0000a234 d _ZN11ClusterData8GetSeedYEv.A$$LSDA
000059f0 t _ZN11ClusterData8GetSeedYEv.J
0000a230 d _ZN11ClusterData8GetSeedYEv.J$$LSDA
000025e0 W _ZN11ClusterData8GetSeedZEv
00005a32 t _ZN11ClusterData8GetSeedZEv.A
0000a23c d _ZN11ClusterData8GetSeedZEv.A$$LSDA
00005a28 t _ZN11ClusterData8GetSeedZEv.J
0000a238 d _ZN11ClusterData8GetSeedZEv.J$$LSDA
U _ZN11ClusterData9SetMemberEffffi
U _ZN11ClusterDataC1Ev
U _ZN11ClusterDataD1Ev

However, it is my understanding that it is supposed to be undefined, because it is defined in the external file An nm check on the other constructors in .hh files shows that they too are undefined, but this causes no problems. I am at a loss.

Here are the files I added to the working file;

// --------------------------------------------------------------------------//

  • TITLE: ClusterData.hh
  • AUTHOR: E. Osenbaugh-Stewart
    // --------------------------------------------------------------------------//

#ifndef _ClusterData_hh
#define _ClusterData_hh

#include “TTree.h”
#include “TObject.h”

class ClusterData : public TObject

Int_t Initialize();
Int_t GetSeedX(){return SeedX;}
Int_t GetSeedY(){return SeedY;}
Int_t GetSeedZ(){return SeedZ;}
void SetSeed(Float_t x,Float_t y,Float_t z,Float_t E);
void SetMember(Float_t x,Float_t y,Float_t z,Float_t E, Int_t pos);
Int_t ClusterSize;

//Seed Coordinates
Float_t SeedX;
Float_t SeedY;
Float_t SeedZ;
Float_t SeedEnergyDep;
//Member Coordinates
Float_t InteractionX[30];
Float_t InteractionY[30];
Float_t InteractionZ[30];
//Energy Info
Float_t EnergyDep[30];

ClassDef(ClusterData, 1)



  • TITLE:
  • AUTHOR: E. Osenbaugh-Stewart

#include “ClusterData.hh”
#include “io/MGLogger.hh”
#include “TObject.h”


ClusterData::ClusterData() :





Int_t a;

SeedEnergyDep = 0;
ClusterSize = 0;
for (a=0; a<30; a++){
InteractionX[a] = 0;
InteractionY[a] = 0;
InteractionZ[a] = 0;
EnergyDep[a] = 0;
return (1);


ClusterData::SetSeed(Float_t z, Float_t y, Float_t z, Float_t E){

SeedX = x;
SeedY = y;
SeedZ = z;
SeedEnergyDep = E;






ClusterData::SetMember(Float_t z, Float_t y, Float_t z, Float_t E, Int_t pos){

InteractionX[pos] = x;
InteractionY[pos] = y;
InteractionZ[pos] = z;
EnergyDep[pos] = E;

I added the include line #include “ClusterData.hh” simAnalcxx is attached if that helps.

Thanks for your help,

simAnal.cxx (18.9 KB)

looks like you are not linking with the or whatever name the library has that contains the compiled version of You might need to compile and load that first. Or you can generate a wrapper script, that #includes both and simAnal.cxx
Cheers, Axel.

Okay, I took your advice and complied ClusterData into a library first ( but when I try to load in that library it won’t let me. It says

root [1] .L /home/osenbaug/MaGe/analysis/
root [2] .L /home/osenbaug/MaGe/analysis/
root [3] .L /home/osenbaug/MaGe/analysis/
dlopen error: /home/osenbaug/MaGe/analysis/ cannot dynamically load executable
Load Error: Failed to load Dynamic link library /home/osenbaug/MaGe/analysis/
*** Interpreter error recovered ***

I attached the object file if that helps. Also could you explain the wrapper tech you mentioned?

Thanks Again,



how exactly do you build the libraries? Does have a main() function? (It cannot - it’s a library, not an executable.)

You can create a libraries.C that has the lines
#include “AllTheOtherSourcesYouBuildLibsFrom.cxx”
#include "simAnal.cxx "
and then just run “.L libraries.C+” and you will create and load a library containing all the sources.

Cheers, Axel.