PDA

View Full Version : how to use static library in qt4?



hashb
26th October 2009, 09:16
Hi All,
when compiling a demo of QT4:"browser"

i got linking errors as below:

webview.cpp:(.text+0x695): undefined reference to `QUiLoader::QUiLoader(QObject*)'
webview.cpp:(.text+0x6cb): undefined reference to `QUiLoader::createWidget(QString const&, QWidget*, QString const&)'
webview.cpp:(.text+0x6ed): undefined reference to `QUiLoader::~QUiLoader()'
webview.cpp:(.text+0x718): undefined reference to `QUiLoader::~QUiLoader()'
but i do specified uitools module when execute the qmake:

qmake -project QT+=network QT+=webkit QT+=uitools

I found the reason is due to in my qt library directory there is only a static library for uitools "libQtUiTools.a" and there is no "libQtUiTools.so".

I make a link using:

ln -s libQtUiTools.a libQtUiTools.so
but it seems it doesn't help.

how to use static library ,any suggestions?

Thanks advance.
hb

hashb
27th October 2009, 06:34
Hi ,

Any ideas about it ?

Any help would be highly appreciated!

Best regards,
hb

high_flyer
27th October 2009, 10:05
what happens if you just do 'qmake' and then 'make'?

hashb
28th October 2009, 03:14
Hi High_flyer,

Thanks for your input,
Here is my steps:
$qmake -project QT+=network QT+=webkit QT+=uitools

$qmake
Project MESSAGE: Warning: unknown QT: uitools

$make
...
webview.cpp:(.text+0x695): undefined reference to `QUiLoader::QUiLoader(QObject*)'
....

Best regards,
hb

arpspatel
28th October 2009, 04:29
hb,

there is no need for libQtUiTools.so for compiling, you should only need libQtUiTools.a when compiling or running.

from the looks of the errors it looks like you are missing some declarations in header file or the project file...

could you attach/paste the webview.cpp and the project file

-Arpit

hashb
28th October 2009, 04:38
Hi Arpit,

The source code can be found in the install path of QT4,

$QTDIR/demos/browser

BTW:
It can link successfully if I add -lQtUiTools in Makefile :

LIBS = .... .... .... -lQtUiTools

but what confusing me is why
qmake QT+=uitools ;qmake;make;
cann't work

Best regards,
hb

hashb
28th October 2009, 04:51
3791

3792

daniel-verite
28th October 2009, 06:41
but what confusing me is why
qmake QT+=uitools ;qmake;make;
cann't work

According to the documentation, the project file should have CONFIG+=uitools (not QT+=uitools)
See http://doc.trolltech.com/4.5/qtuitools.html

hashb
28th October 2009, 11:21
Hi Daniel-verite,

It works! !
Thanks all very much !

Best regards,
hb

arpspatel
28th October 2009, 12:46
it would be easy to add CONFIG += uitools to project file if its not generated automatically..