Results 1 to 4 of 4

Thread: so shared library problem

  1. #1
    Join Date
    May 2007
    Location
    Warsaw, Poland
    Posts
    52
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default so shared library problem

    Guys, quite newbie stuff:
    I have a .so shared library with my brand new InfoBox widget placed in a MTR namespace.
    Then I have a test program:
    Qt Code:
    1. #include <QApplication>
    2. #include <QtCore>
    3. #include <QtGui>
    4.  
    5. int main(int argc, char* argv[]) {
    6. QApplication app(argc, argv);
    7. MTR::InfoBox ib;
    8. ib.show();
    9. app.exec();
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 

    its .pro:
    Qt Code:
    1. TEMPLATE = app
    2. CONFIG += qt
    3. LIBS += -L/home/mtr/Programowanie/Projekty/MTRInfoBox -lMTRInfoBox
    4. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    as you see I link the directory of my .so file as well as its name without "lib" prefix and .so* suffix.

    I do not receive any messages that libMTRInfoBox.so.1.0.1 file hasn't been found.

    Anyway I receive a message as if my test program did not know MTR::InfoBox class. Furthermore it doesn't recognize MTR namespace.

    All in all I must have made some mistake somewhere...

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: so shared library problem

    The application must include a header which declares MTR::InfoBox (just like you include Qt headers which declare Qt classes).
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Location
    Warsaw, Poland
    Posts
    52
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: so shared library problem

    I have added
    Qt Code:
    1. #include <MTRInfoBox>
    To copy to clipboard, switch view to plain text mode 
    and I received:
    Qt Code:
    1. main.cpp:4:22: error: MTRInfoBox: No such file or directory
    To copy to clipboard, switch view to plain text mode 
    then I tried:
    Qt Code:
    1. #include <MTR::InfoBox>
    To copy to clipboard, switch view to plain text mode 
    and I received
    Qt Code:
    1. main.cpp:4:24: error: MTR::InfoBox: No such file or directory
    To copy to clipboard, switch view to plain text mode 

    The libMTRInfoBox.so.1.0.1 file is placed in /home/mtr/Programowanie/Projekty/MTRInfoBox folder.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: so shared library problem

    You should have a header file together with libMTRInfoBox.so.1.0.1.

    First, you must add
    INCLUDEPATH += /home/mtr/Programowanie/Projekty/MTRInfoBox
    to the .pro file to make it possible to include a header file from /home/mtr/Programowanie/Projekty/MTRInfoBox.

    Then, you should use the exact name of the header file in include directive, not "MTR::InfoBox". I don't know what is the header called but let's say its name is mtrinfobox.h:
    Qt Code:
    1. #include "mtrinfobox.h"
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Compiled resources in shared library
    By magland in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2007, 05:57
  2. Problem with SqLite and Qt
    By ad5xj in forum Newbie
    Replies: 26
    Last Post: 5th June 2007, 02:53
  3. shared library problem
    By nhatkhang in forum KDE Forum
    Replies: 9
    Last Post: 28th November 2006, 05:07
  4. HOW TO - created and use shared library (.so)
    By big4mil in forum Qt Programming
    Replies: 4
    Last Post: 26th November 2006, 00:11
  5. id3lib library problem
    By acix in forum General Programming
    Replies: 2
    Last Post: 11th April 2006, 13:46

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.