Results 1 to 5 of 5

Thread: How to link one application to another

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

    Default How to link one application to another

    Hi
    I have a very trivial issue where I have two application (GALLERY) and (ADDFOLDER)
    and I need to make GALLERY dependent on ADDFOLDER.

    The pro file for GALLERY

    Qt Code:
    1. QT += core gui
    2.  
    3. TARGET = GALLERY
    4. TEMPLATE = app
    5.  
    6.  
    7. SOURCES += main.cpp\
    8. mainwindow.cpp \
    9. settingstree.cpp \
    10. displayframe.cpp \
    11. PREVIEWFRAME.cpp \
    12. PanelFrame.cpp \
    13. eBeamTree.cpp \
    14. MainFrame.cpp
    15.  
    16. HEADERS += mainwindow.h \
    17. settingstree.h \
    18. displayframe.h \
    19. PREVIEWFRAME.h \
    20. PanelFrame.h \
    21. eBeamTree.h \
    22. MainFrame.h
    23.  
    24. RESOURCES += \
    25. GALL.qrc
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. QT += core gui
    2.  
    3. TARGET = AddFolder
    4. TEMPLATE = app
    5.  
    6.  
    7. SOURCES += main.cpp\
    8. mainwindow.cpp \
    9. browsemodel.cpp
    10.  
    11. HEADERS += mainwindow.h \
    12. browsemodel.h
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Dec 2010
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to link one application to another

    If you want to link two thing then create a new object of a class which you want to pass to your active function and pass the object show();

    e.g.

    Qt Code:
    1. void yourCurrentClassName::functionName()
    2. {
    3. nameOfTheClassWhichYouWantToInclude *createObjct = new nameOfTheClassWhichYouWantToInclude;
    4. objectName->show();
    5. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by prajnaranjan.das; 24th December 2010 at 09:50.
    Regards:

    Prajnaranjan Das
    e mail: prajnaranjan.das@gmail.com

  3. #3
    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 one application to another

    What do you mean by "make GALLERY dependent on ADDFOLDER"? They are two independent applications. If AddFolder were a library that had to be linked in to Gallery then this might make some sense.

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

    Default Re: How to link one application to another

    I get issue
    make: Leaving directory `/home/kamlesh/Gall/GALL-Build'
    make: *** No rule to make target `../libs/libAddFolder.so', needed by `libAddFolder.so'. Stop.
    The process "/usr/bin/make" exited with code %2.
    Error while building project GALL (target: Desktop)
    When executing build step 'Make'

    I have created the ADDFOLDER as a library
    Qt Code:
    1. TARGET = AddFolder
    2. TEMPLATE = lib
    3.  
    4. CONFIG += dynamic debug
    5.  
    6. SOURCES += main.cpp\
    7. mainwindow.cpp \
    8. browsemodel.cpp
    9.  
    10. HEADERS += mainwindow.h \
    11. browsemodel.h
    To copy to clipboard, switch view to plain text mode 

    and for GALLERY

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

  5. #5
    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 one application to another

    OK, so now you change the question. Your original post has AddFolder as an app.

    The LIBS variable is wrong.

    At compile time:
    1. Use INCLUDEPATH to define extra locations to be searched for header files
    2. Use LIBS -L options to define extra locations to be searched for libraries
    3. Use LIBS -l options to name the libs to be used.

    You try to do 2 and don't do 3 at all. Each -L option takes a single directory to search for missing libraries. Each -l option names a single library to link (the name is not the file name but is related).

    You seem to be confusing the other way specifying LIBS with the UNIX -L/-l style. From the qmake manual
    The paths that qmake searches for libraries and the specific libraries to link against can be added to the list of values in the LIBS variable. The paths to the libraries themselves can be given, or the familiar Unix-style notation for specifying libraries and paths can be used if preferred.
    You want either:
    Qt Code:
    1. LIBS += ../libs/libAddFolder.so
    2. OR
    3. LIBS += -L../libs -lAddFolder
    To copy to clipboard, switch view to plain text mode 
    assuming that the AddFolder library is placed into the ../libs directory when it is built (this is not obviously correct from the information we have).

Similar Threads

  1. How to link a Push Button with a Web link ???
    By prajnaranjan.das in forum Newbie
    Replies: 3
    Last Post: 10th December 2010, 07:25
  2. How to link .exe to dll ?
    By babygal in forum Newbie
    Replies: 19
    Last Post: 19th May 2010, 09:30
  3. Link as a dll
    By bmahf in forum Newbie
    Replies: 8
    Last Post: 15th October 2009, 19:21
  4. How I link a dll?
    By brevleq in forum Qt Programming
    Replies: 3
    Last Post: 15th December 2007, 02:39
  5. Link *.so library
    By allstar in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2007, 15:27

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.