Compilation errors in compiling C++ Analyzer with ROOT Linux libr aries

From: Borse, Ganesh <ganesh.borse_at_credit-suisse.com>
Date: Tue, 27 Nov 2007 15:12:40 +0800


Hi,

I am trying to use the THaCutList & THaVarList classes, which are dependent on ROOT framework.

I have installed the latest binaries of production version (5.16) of ROOT root_v5.16.00.Linux.slc3.gcc3.2.3.tar.gz. Whereas, the C++ Analyzer component which uses ROOT is version 1.4.7. I compiled the analyzer source code and my test program on "Red Hat Enterprise Linux AS release 3 (Taroon Update 4), 2.4.21-9.0.1.Elsmp" having "gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-24)".

Analyzer source code got compiled fine, but when I tried to compile my test program (given below), I got multiple undefined references errors. I have added the required ROOT libraries for linking in the compilation command. Few of them are given below.

COMPILING Debug Version Linux_2.4.21-9.0.1.ELsmp-D/parsertest.o ...
/usr/bin/g++ -g -D_DEBUG -c -fPIC -D_GNU_SOURCE -D_REENTRANT -D_VMT -D_VNIX -D__LINUX__ -D_INTEL_X86_ -I. -I/home/gborse/pxm/root/include -I/home/gborse/pxm/analyzer-1.4.7/src -I/home/gborse/pxm/include -o Linux_2.4.21-9.0.1.ELsmp-D/parsertest.o parsertest.cpp
DONE COMPILING Debug Version Linux_2.4.21-9.0.1.ELsmp-D/parsertest.o !

/usr/bin/g++ Linux_2.4.21-9.0.1.ELsmp-D/parsertest.o /home/gborse/pxm/analyzer-1.4.7/THaCutList.o /home/gborse/pxm/analyzer-1.4.7/THaCut.o /home/gborse/pxm/analyzer-1.4.7/THaPrintOption.o /home/gborse/pxm/analyzer-1.4.7/THaVarList.o /home/gborse/pxm/analyzer-1.4.7/THaVar.o /home/gborse/pxm/analyzer-1.4.7/THaRTTI.o /home/gborse/pxm/analyzer-1.4.7/THaFormula.o /home/gborse/pxm/analyzer-1.4.7/THaNamedList.o -L/home/gborse/pxm/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread -lm -ldl -rdynamic -L/home/gborse/pxm/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lGui -pthread -lm -ldl -rdynamic -L/home/gborse/pxm/lib/Linux_2.4.21-9.0.1.ELsmp -lrt -o /home/gborse/pxm/bin/Linux_2.4.21-9.0.1.ELsmp/parserroottestD
/home/gborse/pxm/analyzer-1.4.7/THaCutList.o(.text+0x22bd): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `ROOT::GenerateInitInstance(THaCutList const*)'
/home/gborse/pxm/analyzer-1.4.7/THaCutList.o(.text+0x22f1): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `ROOT::GenerateInitInstance(THaHashList const*)'
/home/gborse/pxm/analyzer-1.4.7/THaCutList.o(.gnu.linkonce.d._ZTV10THaCutList+0x60): undefined reference to `THaCutList::ShowMembers(TMemberInspector&, char*)'
/home/gborse/pxm/analyzer-1.4.7/THaCutList.o(.gnu.linkonce.d._ZTV10THaCutList+0x64): undefined reference to `THaCutList::Streamer(TBuffer&)'
/home/gborse/pxm/analyzer-1.4.7/THaCutList.o(.gnu.linkonce.d._ZTV11THaHashList+0xe8): undefined reference to `THaHashList::ShowMembers(TMemberInspector&, char*)'
/home/gborse/pxm/analyzer-1.4.7/THaCutList.o(.gnu.linkonce.d._ZTV11THaHashList+0xec): undefined reference to `THaHashList::Streamer(TBuffer&)'

May I please know, why these errors are coming? Do I need to compile the ROOT source also with the same compiler? Do I need to use any additional components or libraries for this compilation to happen?

Please help.

Thanks and Regards,
Ganesh

/*******************************************************************************************/

#include <iostream>
#include <string>
#include <time.h>
#include <THaCutList.h>
#include <THaVarList.h>

int main(int argc, char *argv[])
{

    // parse expression into a parse tree     THaVarList * gHaVars = new THaVarList();     THaCutList * gHaCuts = new THaCutList(gHaVars);     int vol =100;
    gHaVars->Define("vol",vol);
    int ADV = 12345;
    gHaVars->Define("ADV",ADV);
    const char * prod = "Stock";
    gHaVars->Define("prod",prod);
    gHaCuts->Define("Expr","(vol < 10000) && (vol < .001 * ADV) && (prod == \"Stock\")");     for (int i = 0 ; i < 100000 ; i++)
    {
    // evaluate the expression with a very simple symbol table

        prod = "Stock"; 
        vol =  i + 100;
        ADV = i+ 12345;
        gHaCuts->Eval();
        gHaCuts->Print();
        if(i%100 == 0) std::cout << "[" << i/100 << "] \n";
    }
    return 0;
}
/*******************************************************************************************/


Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html


Received on Tue Nov 27 2007 - 08:13:38 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 27 2007 - 17:50:02 CET