[ROOT] gui question

From: Boris Skorodumov (bskorodo@nd.edu)
Date: Tue Dec 14 2004 - 07:21:01 MET


Dear Rooters,

I am based on example guitest.C provided with root 4-00-08f version.
I was trying to compile three files which I attached to this letter with 
the next command:

g++ `root-config --cflags --glibs` -o main main.cxx MyMain.cxx

I got the next linking error:

/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In 
function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status

Maybe this error not connected with root itself, if so, sorry for the 
question that should not be addressed in roottalk.

Thank you very much,
Boris.


-- 
------------------------------------------------
|  Boris Skorodumov, 
|  Graduate Student, Physics Department,
|  University of Notre Dame,
|  Notre Dame, IN 46556, USA
|  WWW:   www.nd.edu/~bskorodo
------------------------------------------------



#include "MyMain.h"

const char *nlabel[] = {
   "Up",
   "Down",
   "Left",
   "Right",
};

const Double_t ninit[] = {5,8,10,21};


MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
{
   fMain = new TGMainFrame(p, w, h);
   fMain->Connect("CloseWindow()", "MyMainFrame", this, "CloseWindow()");
    
   fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX);
   fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
   fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
   
   fMenuFile = new TGPopupMenu(gClient->GetRoot());
   fMenuFile->AddEntry("&Open...", M_FILE_OPEN);
   fMenuFile->AddEntry("&Save", M_FILE_SAVE);
   fMenuFile->AddEntry("S&ave as...", M_FILE_SAVEAS);
   fMenuFile->AddEntry("&Close", -1);
   fMenuFile->AddSeparator();
   fMenuFile->AddEntry("&Print", M_FILE_PRINT);
   fMenuFile->AddEntry("P&rint setup...", M_FILE_PRINTSETUP);
   fMenuFile->AddSeparator();
   fMenuFile->AddEntry("E&xit", M_FILE_EXIT);

   fMenuFile->DisableEntry(M_FILE_SAVEAS);
   fMenuFile->HideEntry(M_FILE_PRINT);
   
   
   fMenuTest = new TGPopupMenu(gClient->GetRoot());
   fMenuTest->AddLabel("Test different features...");
   fMenuTest->AddSeparator();
   fMenuTest->AddEntry("&Dialog...", M_TEST_DLG);
   fMenuTest->AddEntry("&Message Box...", M_TEST_MSGBOX);
   fMenuTest->AddEntry("&Sliders...", M_TEST_SLIDER);
   fMenuTest->AddEntry("Sh&utter...", M_TEST_SHUTTER);
   fMenuTest->AddEntry("&List Directory...", M_TEST_DIRLIST);
   fMenuTest->AddEntry("&File List...", M_TEST_FILELIST);
   fMenuTest->AddEntry("&Progress...", M_TEST_PROGRESS);
   fMenuTest->AddEntry("&Number Entry...", M_TEST_NUMBERENTRY);
   
   fMenuHelp = new TGPopupMenu(gClient->GetRoot());
   fMenuHelp->AddEntry("&Contents", M_HELP_CONTENTS);
   fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
   fMenuHelp->AddSeparator();
   fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
   
   
   fMenuFile->Connect("Activated(Int_t)", "TestMainFrame", this,
                     "HandleMenu(Int_t)");
   fMenuView->Connect("Activated(Int_t)", "TestMainFrame", this,
                     "HandleMenu(Int_t)");
   fMenuHelp->Connect("Activated(Int_t)", "TestMainFrame", this,
                      "HandleMenu(Int_t)");
   
   fF1 = new TGVerticalFrame(fMain, 200, 300);
  
   fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2);
   
   fMain ->AddFrame(fF1, fL1);
   
   fHor1 = new TGHorizontalFrame(fF1, 200, 30);
   fF1->AddFrame(fHor1, fL1);
   fCheck  = new TGCheckButton(fHor1, "PSD Detector", 4);
   fHor1->AddFrame(fCheck, fL1);
   
   for (int i = 0; i < 4; i++) {
   
      fF[i] = new TGHorizontalFrame(fF1, 200, 30);
      fF1->AddFrame(fF[i], fL1);
      fNumericEntries[i] = new TGNumberEntry(fF[i], ninit[i], 3, i + 20,
                   (TGNumberFormat::EStyle) 0);
      fF[i]->AddFrame(fNumericEntries[i], fL1);
      fLabel[i] = new TGLabel(fF[i], nlabel[i]);
      fF[i]->AddFrame(fLabel[i], fL1);
   }
   
   fHor2 = new TGHorizontalFrame(fF1, 200, 30);
   fF1->AddFrame(fHor2, fL1);
   fExit = new TGTextButton(fHor2, "Exit", 2);
   fHor2->AddFrame(fExit, fL1);
   
   fExit->SetCommand(".q" );
   
  
   fMain->MapSubwindows();
   
   fMain->Resize();
   
   fMain->SetWindowName("LdfToRoot Program");
 
   fMain->MapWindow();
}

MyMainFrame::~MyMainFrame()
{
    delete fExit;
    delete fCheck;
   
    delete fF1;
    delete fF2;
    delete [] fF;
    delete fHor1; 
    delete fHor2;
    delete [] fLabel;
    delete [] fNumericEntries;
    
    delete fL1;
    delete fL2;
    delete fL3;
   

    delete fMenuBarLayout;
    delete fMenuBarItemLayout;
    delete fMenuBarHelpLayout;

    delete fMenuFile;
    delete fMenuTest;
    delete fMenuView;
    delete fMenuHelp;

   delete fMain;
}

void MyMainFrame::CloseWindow()
{
   gApplication->Terminate(0);
}
void MyMainFrame::HandleMenu(Int_t id)
{

}


#include "MyMain.h" #ifdef STANDALONE TROOT root("Ldf Test", "Ldf Test"); int main(int argc, char **argv) { TApplication theApp("App", &argc, argv); MyMainFrame mainWin(gClient->GetRoot(), 400, 220); theApp.Run(); return 0; } #endif



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET