Problem with MultiThread..
i have made out a thread for data processing,
I want to read a series data (QPointF) from local harddisk,once a new data comes then tell the main thread to draw the new point,
signal:
newDataCome(QPointF newpoint);
there are nothing like QMutex, QReadWriteLock, QWaitCondition in the qthread ,
than a made a extern object of thread
extern ProcessThread processthread;
but after building there is a error by this row:
connect(&processthread, SIGNAL(newDataCome(QPointF)), this, SLOT(paintNewPoint(QPoint)));
and the error code is:
undefined reference to `_processthread`
i don`t unterstand what is a _processthread?:confused:
thanks for your help!!
Re: Problem with MultiThread..
Where do you declare the actual variable? "extern" means that the variable is available in a different translation unit. Anyway, I'd recommend not to use global variables at all. Why not just declare it as a member variable of some class which manages the thread?
Re: Problem with MultiThread..
Quote:
Originally Posted by
jpn
Where do you declare the actual variable? "extern" means that the variable is available in a different translation unit. Anyway, I'd recommend not to use global variables at all. Why not just declare it as a member variable of some class which manages the thread?
thanks,
in a header file i have declared the Qthread class,
processthread.h
the ProcessThread is used for dataprocess, and will be involked by many instances, so is a "extern"
anyway i don`t unterstand, where come from the "_processthread" ??
Re: Problem with MultiThread..
new error,
now i declare the processthread as a member variable ,
but the error description is changed as follows:
field`processthread`has incomplete type,
what`s meas for that?
Re: Problem with MultiThread..
Could you post some minimal code example that might aid to understand what the problem is?
cheers,
--to
Re: Problem with MultiThread..
Quote:
Originally Posted by
blm
new error,
now i declare the processthread as a member variable ,
but the error description is changed as follows:
field`processthread`has incomplete type,
what`s meas for that?
#include <QThread>
Re: Problem with MultiThread..
at last i find a solution,
previous i write
#include "processthread.h"
in Plotter.cpp
now i write it in Plotter.h,
and declared the processthread class as a member variable in Plotter.
but i still don`t unterstand what`s the difference