View Full Version : QThread and qthread.h


Penguinizer
First time to use QThread class and KDevelop gives unexplained errors.

My code :
#include <qthread.h>
int main(.....){
QThread t;
// Nothing matters after this
}

ERRORS :
QThread : Undifined Identifier .


After checking "qthread.h" I found the there exist a conditional compilation On a MACRO called "QT_THREAD_SUPPORT" or something like that .

But I have no idea where to write it .
and also do I have to enable MultiThreading support , HOW ???

is there any simple examples On QThread. SIMPLE !!!!
Thanks .

uniball
I know nothing about Qt but:
try defining QT_THREAD_SUPPORT
#define QT_THREAD_SUPPORT 1
before you include qthread.h

maybe it'll work

Penguinizer
the answer uniball is posting will really get rid of the compilation error and the header file will include class .But........

This doesn't mean that Qt will support Multithreading .

The answer is : recompile Qt with "-thread" option to make Qt able to create Threads .

alaa
your distro should come with a qt-mt package (it may be called libqt-mt)
this is the QT multithreading support install it and everything should work just fine.

cheers,
Alaa