Roofit error in compiling a code

Dear root

I have a problem in compiling my code.

my test code is simple.
=>
#include “RooRealVar.h”

int main() {

RooRealVar x(“x”,“x”,0,10);

}

In compiling this code, I have the error like following.
=>
//////////////////////////////////////////////////////////////////////////////////////////////////////
make: Warning: File main.o' has modification time 10 s in the future g++ -g main.o -L/home/sckim/cern/lib/root -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lGui -pthread -lm -ldl -rdynamic -lRooFit -L/usr/X11R6/lib -lXpm -lX11 -o main main.o: In functionmain’:
main.cxx:(.text+0xa3): undefined reference to RooRealVar::RooRealVar(char const*, char const*, double, double, char const*)' main.cxx:(.text+0xab): undefined reference toRooRealVar::~RooRealVar()’
/home/sckim/cern/lib/root/libRooFit.so: undefined reference to RooAbsReal::createFundamental(char const*) const' /home/sckim/cern/lib/root/libRooFit.so: undefined reference toRooFit::MoveToBack()’
/home/sckim/cern/lib/root/libRooFit.so: undefined reference to RooAbsAnaConvPdf::isDirectGenSafe(RooAbsArg const&) const' /home/sckim/cern/lib/root/libRooFit.so: undefined reference toRooMsgService::log(TObject const*, RooFit::MsgLevel, RooFit::MsgTopic, bool)’
/home/sckim/cern/lib/root/libRooFit.so: undefined reference to RooFit::SplitParam(RooRealVar const&, RooAbsCategory const&)' /home/sckim/cern/lib/root/libRooFit.so: undefined reference toRooAbsReal::createChi2(RooDataSet&, RooLinkedList const&)’
/home/sckim/cern/lib/root/libRooFit.so: undefined reference to RooAbsPdf::traceEvalHook(double) const' /home/sckim/cern/lib/root/libRooFit.so: undefined reference toRooFit::operator<<(std::basic_ostream<char, std::char_traits >&, RooPrintable const&)’
.
.
.

///////////////////////////////////////////////////////////////////////////////////////////////////////////
I just attached a part of the long error message.

I’m using root 5.24 with CentOS release 5.3 .
gcc info is like following.
=>
////////////////////////////////////////////////////////////////////////////////////////////////////////
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: …/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)
///////////////////////////////////////////////////////////////////////////////////////////////////////////

I configured root like following.
=>
/////////////////////////////////////////////////////////////////////////////////////////////////////////
./configure linuxx8664gcc --prefix=/home/sckim/cern --etcdir=/home/sckim/cern/etc/root --enable-roofit --enable-xrootd --enable-minuit2 --enable-unuran --disable-mathmore
/////////////////////////////////////////////////////////////////////////////////////////////////////////
Please let me know what’s wrong.

:confused:

Hi,

You are missing -lRooFitCore

Cheers,
Philippe.

I have the same problem.
The project is compiling with ROOT 5.34, but when I add some lines from the RooFit tutorial, it prints many warnings and an error that undefined references to included packages were not found (e.g. RooRealVar::RooRealVar(char const*, char const*, double, double, char const*).
How do I include your solution into the CMakeLists.txt file to get the code running?
It already worked in the root command line.