Compiling and using a custom RooFit class

Hello. There isn’t any documentation on how to do this so I want to ask and give future people a reference in how to do this. I used

RooClassFactory::makePdf(“Spectrum”,”x,alpha”) ;

to create a class. I then edited the evaluate section. I then use .L Spectrum.cxx+ to create a library. Within my c++ code, I then use:

gROOT->ProcessLineSync(".x Spectrum.cxx+");

however, I am getting the following:

Undefined symbols for architecture x86_64: "Spectrum::Spectrum(char const*, char const*, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&)", referenced from: _main in Prime.o "vtable for Spectrum", referenced from: Spectrum::~Spectrum() in Prime.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status make: *** [Project] Error 1

once I compile with

[code]R_LDFLAGS = root-config --ldflags
R_LIBS = root-config --libs
R_CFLAGS = root-config --cflags
R_GRAPHICS = root-config --glibs

Project: Prime.C
g++ -Wall -fPIC $(R_ALL) -L $(ROOTSYS)/lib -lRooFitCore -lRooFit -lRooFitCore -lMinuit2 -D_GLIBCXX_PARALLEL -fopenmp -c -o Prime.o Prime.C
g++ -W -Wall $(R_ALL) -L $(ROOTSYS)/lib -lRooFitCore -lRooFit -lRooFitCore -lMinuit2 -lGui -D_GLIBCXX_PARALLEL -fopenmp Prime.o -o Prime

What am I doing wrong? Thank you