So most likely mThread is an uninitialized pointer which points to 0xcdcdcdd1. Don't you think you should have
somewhere?Qt Code:
To copy to clipboard, switch view to plain text mode
So most likely mThread is an uninitialized pointer which points to 0xcdcdcdd1. Don't you think you should have
somewhere?Qt Code:
To copy to clipboard, switch view to plain text mode
J-P Nurmi
Hi
When I give the command in my constructor
Qt Code:
To copy to clipboard, switch view to plain text mode
then Qt return an error like this
.\Test.cpp(70) : error C2259: 'QThread' : cannot instantiate abstract class
due to following members:
'void QThread::run(void)' : is abstract
c:\qt\4.3.0\include\qtcore\qthread.h(87) : see declaration of 'QThread::run'
Last edited by jpn; 31st December 2007 at 10:43. Reason: missing [code] tags
Ahh, indeed. QThread will be non-abstract in Qt 4.4 but until that you will have to implement QThread::run().
J-P Nurmi
Hi,
In my code I had implement the run(). Please see the code , which one i previous declare.
in .h file
and in .cpp file
Qt Code:
void CTest::run() { ..... ..... }To copy to clipboard, switch view to plain text mode
is it correct?
A friendly advise would be to learn C++ before trying to use a comprehensive toolkit written in C++. Using Qt sure requires some knowledge of C++.
What you have shown above declares a method "virtual void run()" in a class which has QThread pointer as a member. That's not at all same than implementing QThread::run().
Notice the difference between:
andQt Code:
{ protected: virtual void run() { ... } QThread* mThread; };To copy to clipboard, switch view to plain text mode
Qt Code:
{ protected: virtual void run() { ... } }; { protected: MyThread* mThread; };To copy to clipboard, switch view to plain text mode
J-P Nurmi
sabeesh (1st January 2008)
Hi,
Its my mistake. Sorry.
I create a class like this
Qt Code:
{ protected: virtual void run(){ while(true){ qDebug()<<"Run"; } } };To copy to clipboard, switch view to plain text mode
and in .h file
and give the command in my constructor like this
Qt Code:
To copy to clipboard, switch view to plain text mode
but the error is like this
Qt Code:
.\Test.cpp(70) : error C2259: 'QThread' : cannot instantiate abstract class due to following members: 'void QThread::run(void)' : is abstract c:\qt\4.3.0\include\qtcore\qthread.h(87) : see declaration of 'QThread::run'To copy to clipboard, switch view to plain text mode
Please help me
QThread is abstract. You must instantiate your QThread subclass:
Qt Code:
mThread = new MyThread(this);To copy to clipboard, switch view to plain text mode
sabeesh (1st January 2008)
Hi,
Ohhhh, It's my mistake. Sorry.
Thankyou for your help
Bookmarks