khello.cc

Some background... I watched a video of Mark Shuttleworth and was telling Hale how much I admire the guy (OK, those were not my exact words - I really admire the guy) and Hale said how he'd gone back to Mandrake/Mandriva. I said he can't blame his crap hardware - he has a cheaper version of the ThinkPad I have. He said that wasn't it, and that he wanted to play with some KDE3/QT3 development. He said he couldn't get his libraries working. He pointed me to the simplest KDE application known to man and I said I'd look at it.

Here's what I did:

mlambie@stormshadow:~$ sudo apt-get install kdelibs4-dev

Then I edited edited the code:

#include <kapp.h>
#include </usr/include/kde/kmainwindow.h>

int main( int argc, char **argv )
{
    KApplication a( argc, argv, "khello" );
    KMainWindow *w = new KMainWindow();
    w->setGeometry(100,100,200,100);

    a.setMainWidget( w );
    w->show();
    return a.exec();
}

I didn't change anything with the code after I verified that my libraries were installed in /usr/lib as expected.

mlambie@stormshadow:~/bin/kde$ g++ -c -I/usr/include/kde -I/usr/include/qt3 -fno-rtti khello.cc
khello.cc: In function `int main(int, char**)':
khello.cc:6: warning: `__comp_ctor' is deprecated (declared at
   /usr/include/kde/kapplication.h:196)
mlambie@stormshadow:~/bin/kde$ g++ -L/usr/lib/kde -lkdeui -lkdecore -lqt-mt -ldl -o khello khello.o
mlambie@stormshadow:~/bin/kde$ ls -l
total 24K
-rwxr-xr-x  1 mlambie mlambie  16K 2005-07-22 01:06 khello
-rw-r--r--  1 mlambie mlambie  283 2005-07-22 00:42 khello.cc
-rw-r--r--  1 mlambie mlambie 3.4K 2005-07-22 01:05 khello.o

The only difference was I needed to change their reference from qt to qt-mt (according to Hale that's the multithreaded library).

The result was:

Mark took off before I could report the success. The only thing I might suggest is making sure he has the right KDE libraries installed, as kubuntu-desktop doesn't provide the development libraries he needs. Proof that Ubuntu > Mandrake ;)

Update: 22/07/2005 01:25AM
I tried the second tutorial, and am having the application crash. I think Mark gave me the wrong URL when he wanted me to test the compile. Tutorial 1 works, 2 doesn't. Having said that, the backtrace mentions threads, so it might be the problem... At worst this is proof that GTK > QT ;)

1 Comment so far

  1. Hale on July 22nd, 2005

    Yes its tutorial 2 I’m having the problem with. I installed Mandrake to see if it was the Ubuntu-supplied library causing the problem, and it’s not, because I’m getting it on Mandrake too.

    I spent a semester coding in GTK for uni, and its fucking awful. I’m hoping QT is better, but theres only one way to find out, which is to actually use it.