Re: Problem with g++

From: Kamil Mętrak <>
Date: Fri, 9 Dec 2005 12:09:54 +0100

Thnk you Rene.
Best regardsKamil

2005/12/9, Rene Brun <>:> You must run with a TApplication object.> See Users Guide, the test programs and your example modified below>> Rene Brun>>> #include <TH1D.h>> #include <TApplication.h>> #include <TCanvas.h>> #include <TGClient.h>> #include <TGFrame.h>> #include<TRootEmbeddedCanvas.h>> #include <RQ_OBJECT.h>>> TGMainFrame *fMain;> TRootEmbeddedCanvas *fEcanvas;> TH1D *fHist;>> int main( int argc, char * argv[] ){>       TApplication theApp("App", &argc, argv);>       fMain = new TGMainFrame(gClient->GetRoot(),200,200);>       fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,200,200);>       fMain->AddFrame(fEcanvas,new> TGLayoutHints(kLHintsExpandX|kLHintsExpandY,10,10,10,1));>       fMain->SetWindowName("Test Frame");>       fMain->MapSubwindows();>       fMain->Resize(fMain->GetDefaultSize());>       fMain->MapWindow();>       fHist = new TH1D("fHist", "Histogram", 100,-10,10);>       fHist->FillRandom("gaus");>       TCanvas *fCanvas = fEcanvas->GetCanvas();>       fCanvas->cd(

);> fHist->Draw("AL");> fCanvas->Update();> theApp.Run();> }>>>> On Thu,> 8 Dec 2005, Kamil Mtrak> wrote:>> > HelloI've got problem with running this code compiled with g++. Everythinggoes with no warning in g++, but when I start it I get> > *** Break *** segmentation violation Generating stack trace... 0xb663f36e in TGClient::GetRoot() const + 0x6 from /opt/root/lib/ 0x080494d5 in main + 0x31 from /home/muz/RootApplication/RootApplication 0xb6333ea2 in __libc_start_main + 0xd2 from /lib/tls/i686/cmov/ 0x08049401 in TCanvasImp::ShowMembers(TMemberInspector&, char*) +0x5d from /home/muz/RootApplication/RootApplication> > I'm using ROOT 5.06.00 on Ubuntu Linux with g++ 3.3.6> > When I tried to run this as macro everything was OK. Any suggestions?> >> > #include <TH1D.h>#include <TCanvas.h>#include <TGClient.h>#include <TGFrame.h>#include <TRootEmbeddedCanvas.h>#include <RQ_OBJECT.h>> > TGMainFrame *fMain;TRootEmbeddedCanvas *fEcanvas;TH1D *fHist;> > int main( int argc!
, char * argv[] ){ fMain = new TGMainFrame(gClient->GetRoot(),200,200); fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,200,200); fMain->AddFrame(fEcanvas, newTGLayoutHints(kLHintsExpandX|kLHintsExpandY,10,10,10,1)); fMain->SetWindowName("Test Frame"); fMain->MapSubwindows(); fMain->Resize(fMain->GetDefaultSize()); fMain->MapWindow(); fHist = new TH1D("fHist", "Histogram", 100,-10,10); fHist->FillRandom("gaus"); TCanvas *fCanvas = fEcanvas->GetCanvas(); fCanvas->cd(); fHist->Draw("AL");}> >> Received on Fri Dec 09 2005 - 12:10:01 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:14 MET