LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Qt Thread Support Problem (https://www.linuxquestions.org/questions/linux-software-2/qt-thread-support-problem-164194/)

zombyLINUX 03-30-2004 11:47 AM

Qt Thread Support Problem
 
Alright, I have solved my problem with compiling a program that contains a class extending QThread by manually making a change to the Makefile generated by qmake.

Here is what the compilation was before I changed it...

g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o main_QtClock.o main_QtClock.cc

g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o QtClock.o QtClock.cc

QtClock.cc:14: error: parse error before `{' token
QtClock.cc:19: error: parse error before `}' token
make: *** [QtClock.o] Error 1

I add the -DQT_THREAD_SUPPORT flag to CXXFLAGS, and reran make it it compiled fine. Here is the compile statment after I changed it.

g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o QtClock.o QtClock.cc

/usr/lib/qt3/bin/moc QtClock.h -o moc_QtClock.cpp

g++ -c -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/include -I/usr/lib/qt3/include -o moc_QtClock.o moc_QtClock.cpp

g++ -o QtClock main_QtClock.o QtClock.o moc_QtClock.o -L/usr/lib/ -L/usr/lib/qt3/lib/ -L/usr/X11R6/lib/ -lqt -lXext -lX11 -lm

My question is how do i reconfigure Qt to make qmake put this flag in without me having to do it every time.

Any ideas...?

zombyLINUX 03-30-2004 11:59 AM

Another thing I had to add to the makefile generated by qmake is -lqt-mt to link the multithread libraries. I would also need qmake to put this in the makefile for me.

Komakino 03-30-2004 02:12 PM

When you did ./configure for installing Qt, did you add the -thread option? If not, that would be your problem.

zombyLINUX 03-30-2004 02:15 PM

I did an YaST install of qt3, do you think I have to get the tar.gz and then configure it that way to get it to work?

Komakino 03-30-2004 02:26 PM

Possibly...I suppose it depends on how SuSE decided to compile the source. I would be surprised if they didn't compile it with thread support, but you never know.

If you do decide to get the source (www.trolltech.com) make sure you read all the documentation and don't forget to include the -thread switch! (Actually I think it warns you that you need it)

Be prepared for a long compile time!


All times are GMT -5. The time now is 08:30 PM.