Error when linking with libs outside ROOT?

Hi

I have a code which I compile outside of root. It works fine, until I want to create a branch from a very simple test class, which I made (hopefully correct). I can create the so file but at the final stage in the compilation, this happens.

g++ -O  mbs.o mbsDict.o lib.so -L/usr/local/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread -lm -ldl -rdynamic  \
        -o mbs
mbsDict.o(.text+0x95): In function `ROOT::GenerateInitInstance(mbsDATA const*)':
mbsDict.cpp: undefined reference to `typeinfo for mbsDATA'
mbsDict.o(.text+0x379): In function `ROOT::new_mbsDATA(void*)':
mbsDict.cpp: undefined reference to `mbsDATA::mbsDATA[in-charge]()'
mbsDict.o(.text+0x39d):mbsDict.cpp: undefined reference to `mbsDATA::mbsDATA[in-charge]()'
mbsDict.o(.text+0x43f): In function `ROOT::newArray_mbsDATA(long)':
mbsDict.cpp: undefined reference to `mbsDATA::mbsDATA[in-charge]()'
mbsDict.o(.text+0x681): In function `G__mbsDict_185_1_0(G__value*, char const*, G__param*, int)':
mbsDict.cpp: undefined reference to `mbsDATA::mbsDATA[in-charge]()'
mbsDict.o(.text+0x71c):mbsDict.cpp: undefined reference to `mbsDATA::mbsDATA[in-charge]()'
mbsDict.o(.text+0x790):mbsDict.cpp: more undefined references to `mbsDATA::mbsDATA[in-charge]()' follow
mbsDict.o(.text+0xbc1): In function `G__mbsDict_185_7_1(G__value*, char const*, G__param*, int)':
mbsDict.cpp: undefined reference to `vtable for mbsDATA'
collect2: ld returned 1 exit status
make: *** [mbs] Error 1

My very simple class mbsDATA is in in file root_tree.h:

#include <TObject.h>
#include "TObject.h"
#include "TClonesArray.h"
#include "TRefArray.h"
#include "TRef.h"

class TDirectory;

class mbsDATA : public TObject {

 private:
    Int_t mbsSevtType;
    Int_t mbsSevtSubType;
    Int_t mbsSevtSerial;

 public:
    mbsDATA();
    virtual ~mbsDATA();
    Int_t GetmbsSevtType() const {return mbsSevtType;}
    Int_t GetmbsSevtSubType() const {return mbsSevtSubType;}
    Int_t GetmbsSevtSerial() const {return mbsSevtSerial;}

    ClassDef(mbsDATA,1) 
};

and in my file where I want to use the class I do a

ClassImp(mbsDATA)

The LinkDef.h looks like

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class mbsDATA+;

#endif

I have tried to orient myself with the aid of Event.cxx etc. in the ~/test lib under ROOT. As you can see I base eth on the example Event. I dont really know where to start now any pointers, or very obvious errors I have made?

Best Regards, and have a nice day
Andreas

most likely you forgot to implement (or compile or link) the constructor and/or destructor of the class mbsDATA.

Cheers,
Philippe.

Thank you for your help. I just found out that was the problem. I really appreciate this forum.

Cheers!
Andreas