PDA

View Full Version : KFileDialog undefined reference



kandalf
7th August 2006, 00:51
Hi guys!
I'm starting to program with KDE. I have some experience on C++ and Qt and now, after a long time away from these tools, I'd like to start programming to this lovely desktop.
I started with a tutorial from Antonio Larrosa's site and I got stucked when I got this error:


MainWindow.o(.text+0x711): In function `MainWindow::fileOpen()':
/home/leonardo/development/console/kde/tutorial/src/MainWindow.cpp:67: undefined reference to `KFileDialog::getOpenURL(QString const&, QString const&, QWidget*, QString

I have included <kfiledialog.h>
Does anybody know why this can be hapenning?

Thanx a lot in advance.

jacek
7th August 2006, 00:53
Maybe you don't link your program with appropriate libraries?

kandalf
7th August 2006, 01:55
Maybe... I'm using KDevelop 3.5.2 I think it takes care of all that stuff.
Is kio the library needed?
I tried to modify the project options adding -lkio to the LDFLAGS on project options menu buth after that I got the message

C compiler cannot create executables

And taking a look to the Makefile generated in the src subdir I found this line:

LIB_KIO = -lkio
What made me think that was using this lib but now, after your post, I found in KDevelop's output that -lkio is not mentioned anywhere. This is the final output of compile try


Making all in src
/bin/sh ../libtool --silent --tag=CXX --mode=link g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -g3 -fno-inline -O0 -g3 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -o tutorial -R /opt/kde/lib -R /usr/lib/qt/lib -R /usr/X11R6/lib -L/usr/X11R6/lib -L/usr/lib/qt/lib -L/opt/kde/lib main.o tutorial.o MainWindow.o MainWindow.moc.o -lkdeui
MainWindow.o(.text+0x711): In function `MainWindow::fileOpen()':
/home/leonardo/development/console/kde/tutorial/src/MainWindow.cpp:67: undefined reference to `KFileDialog::getOpenURL(QString const&, QString const&, QWidget*, QString const&)'
collect2: ld returned 1 exit status


Any ideas what library do I need and how can I add it to KDevelop?

Thanx a lot again and sorry for these newbie questions.

Kandalf

kandalf
7th August 2006, 04:42
Ok, I have the first approach to the solution of this problem.
It is so not the best, but it works.
I had to add -lkio, by hand, to the LDFLAGS line in the Makefile built in srcs after running configure script in the console.
The result LDFLAGS line is:

LDFLAGS = -lkio

Now the question is how to automate this task for KDevelop environment.
Is it a bug in KDevelop or am I doing something wrong?

Cheers!

jacek
7th August 2006, 13:05
I'm don't know much about autotools, but it seems that they add libkio all by themselves.

kandalf
8th August 2006, 02:22
I'm don't know much about autotools, but it seems that they add libkio all by themselves.
I thought so, but aparently they didn't this time.
It might be a KDevelop's or Kandalf's error ;)
Maybe I'm not properly setting project's configuration.

Do you work with KDevelop?

jacek
8th August 2006, 11:16
Do you work with KDevelop?
Yes, but unfortunately I don't use autotools.

kandalf
8th August 2006, 21:50
Nevermind, I found it. In the right side of the KDevelop's window I have a tab with Automake settings.
From there I can modify what I want.

Thanx a lot for your time anyways.

Cheers.