how to use static library in qt4?
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
Re: how to use static library in qt4?
Hi ,
Any ideas about it ?
Any help would be highly appreciated!
Best regards,
hb
Re: how to use static library in qt4?
what happens if you just do 'qmake' and then 'make'?
Re: how to use static library in qt4?
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
Re: how to use static library in qt4?
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
Re: how to use static library in qt4?
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
2 Attachment(s)
Re: how to use static library in qt4?
Re: how to use static library in qt4?
Quote:
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
Re: how to use static library in qt4?
Hi Daniel-verite,
It works! !
Thanks all very much !
Best regards,
hb
Re: how to use static library in qt4?
it would be easy to add CONFIG += uitools to project file if its not generated automatically..