Qt and threading

Paul paul at all-the-johnsons.co.uk
Tue Jan 31 20:27:57 UTC 2006


Hi,

Is the current version of Qt in rawhide threading enabled? I'm trying to
compile some of the threading examples in the C++ GUI Programming With
Qt3 book and get the likes of this out

transactionthread.h:64: error: expected class-name before ‘{’ token
transactionthread.h:74: error: ‘QMutex’ does not name a type
transactionthread.h:64: error: expected class-name before ‘{’ token
transactionthread.h:74: error: ‘QMutex’ does not name a type
transactionthread.h:64: error: expected class-name before ‘{’ token
transactionthread.h:74: error: ‘QMutex’ does not name a type
transactionthread.cpp: In member function ‘void
TransactionThread::addTransaction(Transaction*)’:
transactionthread.cpp:68: error: ‘QMutexLocker’ was not declared in this
scope
transactionthread.cpp:68: error: expected `;' before ‘locker’
transactionthread.cpp:70: error: ‘running’ was not declared in this
scope
transactionthread.cpp:71: error: ‘start’ was not declared in this scope
transactionthread.cpp: In member function ‘void
TransactionThread::run()’:
transactionthread.cpp:79: error: ‘mutex’ was not declared in this scope
transactionthread.cpp: In member function ‘void
TransactionThread::setImage(const QImage&)’:
transactionthread.cpp:106: error: ‘QMutexLocker’ was not declared in
this scope
transactionthread.cpp:106: error: expected `;' before ‘locker’
transactionthread.cpp: In member function ‘QImage
TransactionThread::image()’:
transactionthread.cpp:112: error: ‘QMutexLocker’ was not declared in
this scope
transactionthread.cpp:112: error: expected `;' before ‘locker’

This kinda indicates that threading is not enabled.

qmake is also broken. There is a .pro file in the directory which looks
like this

######################################################################
# Automatically generated by qmake (1.07a) Mon Jan 30 22:10:55 2006
######################################################################

TEMPLATE = app
INCLUDEPATH += .

# Input
HEADERS += imagewindow.h transactionthread.h
INTERFACES += resizedialog.ui
SOURCES += imagewindow.cpp main.cpp transactionthread.cpp

If I run

qmake -o Makefile imagepro.pro

All I get out is multiple lines of

QFile::open: No file name specified.

I'll bugzilla the qmake problem now, but can someone check the threading
issue?

If I add -DQT_THREAD_SUPPORT to the compile line (which is

g++ imagewindow.cpp main.cpp transactionthread.cpp -o imagepro
-DQT_THREAD_SUPPORT -I/usr/lib64/qt-3.3/include -L/usr/lib64/qt-3.3/lib
-lqt-mt

)

all I get is...

/tmp/cc2HVhyW.o: In function `ImageWindow::setCurrentFile(QString
const&)':imagewindow.cpp:(.text+0xef): undefined reference to
`ImageWindow::tr(char const*, char const*)'
:imagewindow.cpp:(.text+0x11a): undefined reference to
`ImageWindow::tr(char const*, char const*)'
:imagewindow.cpp:(.text+0x25b): undefined reference to
`ImageWindow::tr(char const*, char const*)'
/tmp/cc2HVhyW.o: In function `ImageWindow::saveFile(QString
const&)':imagewindow.cpp:(.text+0x46d): undefined reference to
`ImageWindow::tr(char const*, char const*)'
:imagewindow.cpp:(.text+0x4bc): undefined reference to
`ImageWindow::tr(char const*, char const*)'
/tmp/cc2HVhyW.o:imagewindow.cpp:(.text+0x662): more undefined references
to `ImageWindow::tr(char const*, char const*)' follow
/tmp/cc2HVhyW.o: In function
`ImageWindow::resizeImage()':imagewindow.cpp:(.text+0x2a26): undefined
reference to `ResizeDialog::ResizeDialog(QWidget*, char const*, bool,
unsigned int)'
:imagewindow.cpp:(.text+0x2b33): undefined reference to
`ResizeDialog::~ResizeDialog()'
:imagewindow.cpp:(.text+0x2b4f): undefined reference to
`ResizeDialog::~ResizeDialog()'
/tmp/cc2HVhyW.o: In function
`ImageWindow::saveAs()':imagewindow.cpp:(.text+0x2d37): undefined
reference to `ImageWindow::tr(char const*, char const*)'
:imagewindow.cpp:(.text+0x2d60): undefined reference to
`ImageWindow::tr(char const*, char const*)'
/tmp/cc2HVhyW.o: In function
`ImageWindow::maybeSave()':imagewindow.cpp:(.text+0x2f3b): undefined
reference to `ImageWindow::tr(char const*, char const*)'
:imagewindow.cpp:(.text+0x2f4e): undefined reference to
`ImageWindow::tr(char const*, char const*)'
/tmp/cc2HVhyW.o: In function
`ImageWindow::customEvent(QCustomEvent*)':imagewindow.cpp:(.text
+0x3311): undefined reference to `ImageWindow::tr(char const*, char
const*)'
/tmp/cc2HVhyW.o:imagewindow.cpp:(.text+0x3387): more undefined
references to `ImageWindow::tr(char const*, char const*)' follow
/tmp/cc2HVhyW.o: In function `ImageWindow::ImageWindow(QWidget*, char
const*)':imagewindow.cpp:(.text+0x34c8): undefined reference to `vtable
for ImageWindow'
:imagewindow.cpp:(.text+0x34d4): undefined reference to `vtable for
ImageWindow'
/tmp/cc2HVhyW.o: In function `ImageWindow::ImageWindow(QWidget*, char
const*)':imagewindow.cpp:(.text+0x3712): undefined reference to `vtable
for ImageWindow'
:imagewindow.cpp:(.text+0x371e): undefined reference to `vtable for
ImageWindow'
/tmp/ccglLyf0.o: In function
`ImageWindow::~ImageWindow()':main.cpp:(.text._ZN11ImageWindowD1Ev[ImageWindow::~ImageWindow()]+0x14): undefined reference to `vtable for ImageWindow'
/tmp/ccglLyf0.o:main.cpp:(.text._ZN11ImageWindowD1Ev[ImageWindow::~ImageWindow()]+0x20): more undefined references to `vtable for ImageWindow' follow
collect2: ld returned 1 exit status

Which is *REALLY* puzzling!

TTFN

Paul
-- 
"wir kamen, wir sahen, wir traten ihren Esel" - Dr Venkman, Ghostbusters
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.fedoraproject.org/pipermail/test/attachments/20060131/5d60d930/attachment.bin 


More information about the test mailing list