Hello,
Normally I don’t have any compiler issues for class inheritance with TObject. But now I would like to inherit RooAbsPdf in order to create PDFs that can be used by RooFit.
RooTest.h:
[code]#ifndef ROOTEST
#define ROOTEST
#include “RooRealProxy.h”
#include “RooAbsReal.h”
#include “RooAbsPdf.h”
#include “TObject.h”
class RooTest : public RooAbsPdf {
public:
RooTest() {} ;
RooTest(const RooTest& other, const char* name=0) ;
// virtual TObject* clone(const char* newname) const { return new RooTest(*this,newname); }
inline virtual ~RooTest() { }
protected:
Double_t evaluate() const ;
private:
ClassDef(RooTest,1) // Your description goes here…
};
#endif[/code]
RooTest.C:
[code] #include “RooTest.h”
ClassImp(RooTest)
RooTest::RooTest(const RooTest& other, const char* name) :
RooAbsPdf(other,name) {
}
Double_t RooTest::evaluate() const {
return (0.5);
}[/code]
I am receiving a compiling error. Here is the beginning of the output from ‘make’:
[quote]/usr/bin/c++ -O2 -pipe -Wall -W -Woverloaded-virtual -m64 -I/Users/ericwhite/root_v34/include -c -o RooTest.o RooTest.C
Generating dictionary …
/usr/bin/c++ -O2 -pipe -Wall -W -Woverloaded-virtual -m64 -I/Users/ericwhite/root_v34/include -c -o eventdict.o eventdict.C
/usr/bin/c++ -dynamiclib -single_module -install_name /Users/ericwhite/Desktop/work/rootest4/event.sl -O2 -mmacosx-version-min=10.8 -m64 RooTest.o eventdict.o -o event.sl -L/Users/ericwhite/root_v34/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lm -ldl -L/Users/ericwhite/root_v34/lib -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lm -ldl
Undefined symbols for architecture x86_64:
“RooAbsReal::createChi2(RooDataSet&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&)”, referenced from:
vtable for RooTest in RooTest.o[/quote]
(I have attached full logfile and Makefile.) This error does NOT happen with ACLiC, I get no errors when I open Root and type “.L RooTest.C+”.
You may ask “why not just use ACLiC”? The reason is that I plan to write several classes, so I need to be able to compile them all at once (which can be done with a Makefile). I don’t know if there is any way to create a shared library for many files using the ACLiC method (".L [many classes here]+").
I am running version 5.34/14 on MacBook Pro (OSX 10.8.5). Thank you for any help.
Makefile.txt (1.53 KB)
log.txt (14.8 KB)