Hi Paul, SurfMainFrame::fExternTest should be a static class method and not a member function. Cheers, Fons. On Thu, 2002-06-27 at 16:47, P.Dixon wrote: > Hi, > > I've been trying to compile some code to use threads, but so far I've not > got past the compilation stage. Currently I have a class with lots of > member funtions and I wrote two extra member functions to try and run a > perl script in the background and pipe the output into a TGTextView. > > These are my member functions: > > void SurfMainFrame::fExternalTest(void){ > 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("Ethread", SurfMainFrame::fExternalTest); > fEthread->Run(); > } > > And from the header file: > public: > void fExternalTest(void); > void fThreadTest(void); > private: > TThread *fEthread; > > but when I compile the compilation stops at the line: > > fEthread = new TThread("Ethread", SurfMainFrame::fExternalTest); > > from above: > > SurfMainFrame.cxx: In method `void SurfMainFrame::fThreadTest ()': > SurfMainFrame.cxx:307: assuming & on `SurfMainFrame::fExternalTest' > SurfMainFrame.cxx:307: no matching function for call to > `TThread::TThread (const char[8], void (SurfMainFrame::*) ())' > /usr/local/cern/root/include/TThread.h:109: candidates are: > TThread::TThread (void *(*) (void *), void > * = 0, TThread::EPriority = kNormalPriority) > /usr/local/cern/root/include/TThread.h:110: > TThread::TThread (void (*) (void *), void * > = 0, TThread::EPriority = kNormalPriority) > /usr/local/cern/root/include/TThread.h:111: > TThread::TThread (int = 0) > /usr/local/cern/root/include/TThread.h:112: > TThread::TThread (const char *, void *(*) > (void *), void * = 0, TThread::EPriority = kNormalPriority) > /usr/local/cern/root/include/TThread.h:113: > TThread::TThread (const char *, void (*) > (void *), void * = 0, TThread::EPriority = kNormalPriority) > /usr/local/cern/root/include/TThread.h:177: > TThread::TThread (const TThread &) > make: *** [SurfMainFrame.o] Error 1 > > I've looked ad I've tried everything I can think of to get this working, > but somehing is eluding me. Anyone have some hints for me? > > Without these member functions, my code compiles and runs fine, so it's > these additions causing me problems. > > ROOT 3.03/06, Intel Red Hat 7.2 SMP > > Cheers, > Paul > -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:58 MET