Hi Rooters,
I am trying to build a standalone GUI-Program using Root. Therefore I read chapter 21 “Writing a Graphical User Interface” from the 3.10 User’s Guide. The example macro on page 361 works fine using the interpreter. But I have problems running the example Standalone program. It compiles fine, but during runtime I get the following error
"Error in TQObject::CheckConnectArgs: slot DoDraw() does not exist".
Looking at the thread
root.cern.ch/root/roottalk/roottalk03/0520.html
I inserted
ClassDef(MyMainFrame,0);
at the end of MyMainFrame.h, but then it won’t compile at all. I get the following errors from the linker:
Linking…
rootguitest.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall MyMainFrame::Streamer(class TBuffer &)” (?Streamer@MyMainFrame@@UAEXAAVTBuffer@@@Z)
rootguitest.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall MyMainFrame::ShowMembers(class TMemberInspector &,char *)” (?ShowMembers@MyMainFrame@@UAEXAAVTMemberInspector@@PAD@Z)
rootguitest.obj : error LNK2001: unresolved external symbol “public: static class TClass * __cdecl MyMainFrame::Class(void)” (?Class@MyMainFrame@@SAPAVTClass@@XZ)
I am using VC++6 with root ver.3.10/2 running on a win2k computer.
I also tried to make $ROOTSYS/test/guiviewer.cxx as this is a recommended beginning, but It gave me the same
linking errors.
Does anybody know what the problem is, or how I get the signal-slot mechanism to work?
Thank you
lutz
files:
MyMainFrame.h:
//
#include <TGFrame.h>
class MyMainFrame : public TGMainFrame
{
private:
TRootEmbeddedCanvas * fEcanvas;
public:
MyMainFrame(const TGWindow p, int w, int h);
virtual ~MyMainFrame();
void DoDraw(); // SIGNAL
ClassDef(MyMainFrame,0) //GUI example
};
//
MyMainFrame.cxx:
/**************************************/
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include “mymainframe.h”
MyMainFrame::MyMainFrame(const TGWindow *p, int w, int h)
:TGMainFrame(p,w,h)
{
/snip/
TGTextButton *draw = new TGTextButton(hframe,"&Draw");
draw->Connect(“Clicked()”,“MyMainFrame”,this,“DoDraw()”);
hframe->AddFrame(draw, new TGLayoutHints(kLHintsCenterX,5,5,3,4));
/*****snip*******/
}
MyMainFrame::~MyMainFrame()
{
}
void MyMainFrame::DoDraw()
{
cout<<“hello”<<endl;
}
int main(int argc, char* argv[])
{
TApplication theApp(“App”,&argc,argv);
new MyMainFrame(gClient->GetRoot(),200,200);
theApp.Run();
return 0;
}
/**************************************/