Results 1 to 8 of 8

Thread: KFileDialog undefined reference

  1. #1
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default KFileDialog undefined reference

    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.
    Last edited by jacek; 6th August 2006 at 23:54. Reason: change [ code ] to [ quote ] to allow wrapping
    Kandalf
    There's no place like ~

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    Maybe you don't link your program with appropriate libraries?

  3. #3
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    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
    There's no place like ~

  4. #4
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    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:
    Qt Code:
    1. LDFLAGS = -lkio
    To copy to clipboard, switch view to plain text mode 

    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!
    Kandalf
    There's no place like ~

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    I'm don't know much about autotools, but it seems that they add libkio all by themselves.

  6. #6
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    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?
    Kandalf
    There's no place like ~

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    Quote Originally Posted by kandalf
    Do you work with KDevelop?
    Yes, but unfortunately I don't use autotools.

  8. #8
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KFileDialog undefined reference

    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.
    Kandalf
    There's no place like ~

Similar Threads

  1. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  2. Strange error while using Q3Canvas
    By Kapil in forum Newbie
    Replies: 13
    Last Post: 15th June 2006, 19:36
  3. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 08:52
  4. undefined reference to fftw libraries
    By kmyadam in forum General Programming
    Replies: 2
    Last Post: 9th March 2006, 01:01
  5. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.