Hi, This might be a silly question ... but did you link against the thread library? (I.e. added -lThread). The message undefined reference to `TThread::TThread(char const *, void (*)(void *), void *, TThread::EPriority)' sounds like a linker error. The method TThread::TThread is implemented in TThread.cxx which is compiled in libThread.so (same of TThread type_info). > is there anything special I have to have in my linkdef file for a > static member funtion? No there is not. The error you mentioned are unrelated. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch] On Behalf Of P.Dixon Sent: Friday, June 28, 2002 10:02 AM To: roottalk@pcroot.cern.ch Subject: Re: [ROOT] 1st go with threads > SurfMainFrame::fExternTest should be a static class method and not a > member function. > Cheers... one step closer... however... is there anything special I have to have in my linkdef file for a static member funtion? I'm getting some compile messages I don't understand: Compiling canvasgui.cxx ... SurfMainFrame.o: In function `SurfMainFrame::fThreadTest(void)': SurfMainFrame.o(.text+0x3133): undefined reference to `TThread::TThread(char const *, void (*)(void *), void *, TThread::EPriority)' SurfMainFrameDict.o: In function `TBuffer & operator>><TThread>(TBuffer &, TThread *&)': SurfMainFrameDict.o(.gnu.linkonce.t.__rs__H1Z7TThread_R7TBufferRPX01_R7T Buffer+0xd): undefined reference to `TThread type_info function' collect2: ld returned 1 exit status make: *** [canvasgui] Error 1 my linkdef is: #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class SurfMainFrame; #pragma link C++ global gSurfMainFrame; #endif I've been trying to follow the examples from: http://www-linux.gsi.de/~go4/HOWTOthreads/howtoframe.html And now I have .h file: static void fExternalTest(void *fTarg); void fThreadTest(void); TThread *fEthread; .cxx file: void SurfMainFrame::fExternalTest(void *fTarg){ char fReadLineText[1000]; FILE* in = gSystem->OpenPipe("./run.sh", "r"); while (!feof(in)){ fgets(fReadLineText, 1000, in); printf(fReadLineText); //fScaleTextView->AddLine(fReadLineText); } fclose(in); } void SurfMainFrame::fThreadTest(void){ fEthread = new TThread("t1", &SurfMainFrame::fExternalTest, (void *)"0"); // fEthread->Run(); } Cheers, Paul
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:58 MET