Hi Florian,
All your classes must have a default constructor. This default
constructor is used by Root I/O in particular to create an instance
of a class before invoking its Streamer method when you read an object
from a file.
The default constructor should not internally allocate objects
or dynamic arrays. If you do so, you must be cautious in the
corresponding destructor.
Below, you will find a slightly modified example with the script
to create a shared lib.
Rene Brun
//----------script
rootcint -f cint.C -c MChip.h MChipLinkDef.h
g++ -fno-rtti -fno-exceptions -fPIC -I$ROOTSYS/include -c cint.C MChip.C
g++ -g -Wl,-soname,MChip.so -shared cint.o MChip.o -o MChip.so
//----------file MChip.h
#include <TNamed.h>
#include <TH1.h>
class MChip : public TObject
{
private:
TH1F *CommonModeHist;
TH1F *NHitHist;
public:
MChip(){}
MChip(Int_t nChannel, TString Appelation );
ClassDef(MChip,1)
} ;
//-----------file MChipLinkDef.h
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class MChip;
#endif
//---------file MChip.C
#include "MChip.h"
ClassImp(MChip)
MChip::MChip(Int_t N, TString Appelation)
{
CommonModeHist = new TH1F("CommonMode","CommonMode",50,-25.0,25.0);
CommonModeHist->SetDirectory(0);
NHitHist = new TH1F("NHits","Number of Hits",10,0,10);
NHitHist->SetDirectory(0);
}