Ciao,
I’m doing a proof of concept application that uses QT+Root. I compiled and installed ROOT with the following options (using prebuild packages is not an option, in this case)
./configure --prefix=/sw/root --enable-table --with-dcap-libdir=/afs/cern.ch/sw/lcg/external/dcap/1.2.33/slc3_ia32_gcc323/lib --with-dcap-incdir=/afs/cern.ch/sw/lcg/external/dcap/1.2.33/slc3_ia32_gcc323/include --enable-python --enable-explicitlink --enable-qt --with-python-incdir=/afs/cern.ch/cms/external/lcg/external/Python/2.3.4/slc3_ia32_gcc323/include/python2.3 --with-python-libdir=/afs/cern.ch/cms/external/lcg/external/Python/2.3.4/slc3_ia32_gcc323/lib --with-qt-incdir=/afs/cern.ch/cms/external/lcg/external/qt/3.3.4/slc3_ia32_gcc323/include --with-qt-libdir=/afs/cern.ch/cms/external/lcg/external/qt/3.3.4/slc3_ia32_gcc323/lib --incdir=/sw/root/include --libdir=/sw/root/lib --help
and I tried something simple as follows:
#include “TGraph.h”
#include “TQtWidget.h”
#include “TCanvas.h”
#include “TGQt.h”
#include <qapplication.h>
#include <qwidget.h>
int main( int argc, char **argv )
{
QApplication *app = new QApplication (argc, argv);
TGQt tgqt;
tgqt.Init (0);
TQtWidget *MyWidget= new TQtWidget(0, "MyWidget");
MyWidget->show();
MyWidget->GetCanvas()->cd();
TGraph *mygraph;
float x[3] = {1,2,3};
float y[3] = {1.5, 3.0, 4.5};
mygraph = new TGraph(3,x,y);
mygraph->SetMarkerStyle(20);
mygraph->Draw("AP");
MyWidget->GetCanvas()->Update();
app->exec ();
return 0;
}
which I compiled with
c++ -pthread -I/sw/include/root -L/sw/lib/root -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lGQt -pthread -lm -ldl -rdynamic -I/afs/cern.ch/cms/external/lcg/external/qt/3.3.4/slc3_ia32_gcc323/include test/test_TQtWidget.cpp
This crashes in
0x002be5c1 in TClass::New () from /sw/root/lib/libCore.so
#1 0x00b4955c in TVirtualHistPainter::HistPainter () from /sw/root/lib/libHist.so
#2 0x00add8be in TH1::GetPainter () from /sw/root/lib/libHist.so
#3 0x00ae236f in TH1::Paint () from /sw/root/lib/libHist.so
#4 0x00cd8437 in TGraph::PaintGraph () from /sw/root/lib/libGraf.so
#5 0x00cd6fe0 in TGraph::Paint () from /sw/root/lib/libGraf.so
#6 0x00f5ad67 in TPad::PaintModified () from /sw/root/lib/libGpad.so
#7 0x00f40c3d in TCanvas::Update () from /sw/root/lib/libGpad.so
#8 0x08048e67 in main ()
Further investigation suggest that the
gROOT->GetPluginManager()->FindHandler(“TVirtualHistPainter”)
returns 0 (even when issued from the root prompt).
Any idea of what I’m doing wrong? I assume I misinstalled root, but how?
Ciao,
Giulio
PS:
LD_LIBRARY_PATH=/sw/root/lib:…
PATH=/sw/root/bin:…
ROOTSYS=/sw/root