Results 1 to 2 of 2

Thread: How to link a shared library to app

  1. #1
    Join Date
    Mar 2010
    Posts
    54
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default Re: How to link a shared library to app

    Hi
    I have a to link a shared library in my app
    May I know what mistake I am doing
    the pro file

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2010-11-29T16:54:50
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. TARGET = GALLERY
    10. TEMPLATE = app
    11.  
    12. SOURCES += main.cpp\
    13. mainwindow.cpp \
    14. settingstree.cpp \
    15. displayframe.cpp \
    16. PREVIEWFRAME.cpp \
    17. PanelFrame.cpp \
    18. eBeamTree.cpp \
    19. MainFrame.cpp
    20.  
    21. HEADERS += mainwindow.h \
    22. settingstree.h \
    23. displayframe.h \
    24. PREVIEWFRAME.h \
    25. PanelFrame.h \
    26. eBeamTree.h \
    27. MainFrame.h
    28.  
    29. RESOURCES += \
    30. GALL.qrc
    31.  
    32. unix:INCLUDEPATH += ../../libs
    33.  
    34. #unix {
    35. # LIBS += -L ../libs/libAddFolder.so ../libs/libAddFolder.so.1 ../libs/libAddFolder.so.1.0 ../libs/libLinkFolder.so.1.0.0
    36. #}
    37.  
    38. unix {
    39. LIBS += -L ../../libs/libLinkFolder.so.1.0.0
    40. }
    41.  
    42. unix {
    43. # adding all these versions because Qt by default creates 3 levels of linking for version control
    44. AddFolder.target = libAddFolder.so
    45. AddFolder.commands = $(COPY) ../../libs/libAddFolder.so $$AddFolder.target
    46. AddFolder.depends = ../../libs/libAddFolder.so
    47.  
    48. AddFolder1.target = libAddFolder.so.1
    49. AddFolder1.commands = $(COPY) ../../libs/libAddFolder.so.1 $$AddFolder1.target
    50. AddFolder1.depends = ../../libs/libAddFolder.so.1
    51.  
    52. AddFolder10.target = libAddFolder.so.1.0
    53. AddFolder10.commands = $(COPY) ../../libs/libAddFolder.so.1.0 $$AddFolder10.target
    54. AddFolder10.depends = ../../libs/libAddFolder.so.1.0
    55.  
    56. AddFolder100.target = libAddFolder.so.1.0.0
    57. AddFolder100.commands = $(COPY) ../../libs/libAddFolder.so.1.0.0 $$AddFolder100.target
    58. AddFolder100.depends = ../../libs/libAddFolder.so.1.0.0
    59.  
    60. QMAKE_EXTRA_TARGETS += AddFolder AddFolder1 AddFolder10 AddFolder100
    61. POST_TARGETDEPS += libAddFolder.so libAddFolder.so.1 libAddFolder.so.1.0 libAddFolder.so.1.0.0
    62.  
    63. QMAKE_LFLAGS += -Wl,-rpath .
    64. }
    65. INSTALLS += AddFolder
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. QT += gui \
    2. core\
    3. network \
    4. xml
    5.  
    6. TARGET = AddFolder
    7. TEMPLATE = lib
    8.  
    9. CONFIG += dynamic debug
    10.  
    11. SOURCES += main.cpp\
    12. mainwindow.cpp \
    13. browsemodel.cpp
    14.  
    15. HEADERS += mainwindow.h \
    16. browsemodel.h
    To copy to clipboard, switch view to plain text mode 


    Added after 45 minutes:


    The library files gets created at the path
    /home/kamlesh/Test/Libs

    The Application needs to be created in
    /home/kamlesh/Test/Gallery
    Last edited by kamlmish; 24th December 2010 at 10:46.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to link a shared library to app

    Your LIBS variable is set incorrectly. (Educated guess based on the most common mistakes, error messages you didn't tell us about, and what you showed us.)

    Did you search the forum before you asked this? There is plenty of information in this forum, and even a couple of recent, complete examples.

    http://www.qtcentre.org/threads/3684...shared+library
    (particularly http://www.qtcentre.org/threads/3684...851#post169851)
    http://www.qtcentre.org/threads/3643...shared+library

Similar Threads

  1. Can I link shared library in static build program?
    By berlinud in forum Installation and Deployment
    Replies: 1
    Last Post: 27th August 2010, 16:36
  2. how to use shared library
    By assismvla in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2009, 21:29
  3. Problem with NCReport : can't link shared library !
    By QAmazigh in forum Qt Programming
    Replies: 4
    Last Post: 5th June 2009, 23:38
  4. Qt/Mac Shared Library
    By nareshqt in forum Qt Programming
    Replies: 0
    Last Post: 21st April 2008, 07:21
  5. shared library problem
    By nhatkhang in forum KDE Forum
    Replies: 9
    Last Post: 28th November 2006, 04:07

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.