how can i compile and run kde-programs with the qt-librarie

Christopher Molnar molnarc at nebsllc.com
Sun Jan 30 03:14:53 GMT 2000


As promised, I did take a look at this and some comments are below:
> > 
> > #include <qapplictaion.h>
> > #include <qpushbutton.h>
> > 
> > int main(int argc, char **argv) {
> >     QApplication App(argc, argv);
> >     QPushButton Button(0, "hello world");

Switch the 0, and the "hello world" around. Don't know why, but it works.

> >     Button.resize(100, 30);
> >     App.setMainWidget(  &Button);
> >     Button.show();
> >     return App.exec();
> > }

The rest of the code looks good.

> > 
> > i compiled it with : g++ first.cc -o first.e -shared 
> > /home/user/lib/qt/lib/libqt.so.2.0.2 or with .../libqt.so.1.44

With that command line I got the same thing. Try this instead:

g++ first.cc -o first.e -L/home/user/lib/qt/lib/libqt.so.2.0.2
-L/usr/X11R6/lib -lqt -lXext -lX11 -lm

In your compile you where getting the qt into the build, but you where not
getting any of the X11 libs or instructions.

I didn't figure it out at first, but sometimes knowing where to look helps
a lot. Look in your qt/tutorials/t1 directory and take a look at the
Makefile. This sort of gives it away.

A lot of development, in my opinion, is knowing the right place to look
and having good examples to work from.

Hope that helps!
Chris





More information about the KDevelop mailing list