PDA

View Full Version : Error using kdebutton widget in QT



mysearch05
7th February 2006, 18:33
hi
i m using KDE3 and QT3.3.4

i want to use a KDE button which is provided in the QT-Designer menu. When i add this button to a form and compile, it gives an error:

[localhost test]$ make
g++ -o test .obj/main.o .obj/frm_main.o .obj/qmake_image_collection.o .obj/moc_frm_main.o -L/usr/lib/qt-3.3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
.obj/frm_main.o(.text+0x1a6): In function `frm_main::frm_main(QWidget*, char const*, unsigned int)':
.ui/frm_main.cpp:38: undefined reference to `KKeyButton::KKeyButton(QWidget*, char const*)'
.obj/frm_main.o(.text+0x312): In function `frm_main::frm_main(QWidget*, char const*, unsigned int)':
.ui/frm_main.cpp:38: undefined reference to `KKeyButton::KKeyButton(QWidget*, char const*)'
collect2: ld returned 1 exit status
make: *** [test] Error 1

I know that this is some linking problem. How to solve it?Please help...
Where and how should i add this KDE include dir information.
My KDE header files are in '/usr/include/kde/'

Thanks...

jacek
7th February 2006, 18:56
Try adding "LIBS += -lkdeui" to your .pro file.

wysota
7th February 2006, 19:58
You may also need to substitute QApplication with KApplication.

mysearch05
8th February 2006, 19:35
Thanks
Adding "LIBS += -lkdeui" to .pro file worked.

But still a problem, when i click on this button, it leads to "Segmentation Fault" and the application gets terminated. What can be the possible cause and a solution???
I have mapped the 'Clicked()' event to form's 'Close()'

Thanks...

jacek
8th February 2006, 19:50
But still a problem, when i click on this button, it leads to "Segmentation Fault" and the application gets terminated.
Could you post the backtrace?


What can be the possible cause and a solution???
As Wysota suggested, you might need to use KApplication and other KDE classes to make it work.