Dear experts,
I am trying to create a new PDF and use the RooClassFactory for this. However the code generated by this doesn’t link:
g++ test_main.cpp `root-config --libs --glibs --cflags` -lRooFitCore -lRooFit
/tmp/cc4x49eM.o: In function `__static_initialization_and_destruction_0(int, int)':
test_main.cpp:(.text+0x463): undefined reference to `ROOT::GenerateInitInstance(RooMyPdf const*)'
/tmp/cc4x49eM.o: In function `RooMyPdf::IsA() const':
test_main.cpp:(.text._ZNK8RooMyPdf3IsAEv[_ZNK8RooMyPdf3IsAEv]+0xd): undefined reference to `RooMyPdf::Class()'
/tmp/cc4x49eM.o: In function `RooMyPdf::ShowMembers(TMemberInspector&) const':
test_main.cpp:(.text._ZNK8RooMyPdf11ShowMembersER16TMemberInspector[_ZNK8RooMyPdf11ShowMembersER16TMemberInspector]+0x11): undefined reference to `RooMyPdf::Class()'
/tmp/cc4x49eM.o:(.rodata._ZTV8RooMyPdf[_ZTV8RooMyPdf]+0x1e0): undefined reference to `RooMyPdf::Streamer(TBuffer&)'
/tmp/cc4x49eM.o:(.rodata._ZTV8RooMyPdf[_ZTV8RooMyPdf]+0x660): undefined reference to `non-virtual thunk to RooMyPdf::Streamer(TBuffer&)'
collect2: error: ld returned 1 exit status
When I remove the offending lines:
ClassImp(RooMyPdf);
ClassDef(RooMyPdf,1) // Your description goes here...
It compiles but then it generates a segfault instead.
./a.out
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[#1] INFO:NumericIntegration -- RooRealIntegral::init(test_Int[y]) using numeric integrator RooIntegrator1D to calculate Int(y)
*** Error in `./a.out': free(): invalid pointer: 0x0000000002525254 ***
======= Backtrace: =========
Is there anything wrong with my use of the factory?
Regards,
Albert