Results 1 to 2 of 2

Thread: Multi target projects

  1. #1
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Multi target projects

    I have a project wihich should build a shared library and a test program for it. I have created a project:
    Qt Code:
    1. TEMPLATE = subdirs
    2.  
    3. SUBDIRS += \
    4. library \
    5. exe
    6.  
    7. exe.depends = library
    To copy to clipboard, switch view to plain text mode 
    a library project:
    Qt Code:
    1. TEMPLATE = lib
    2. TARGET = mylib
    3. QT = core
    4. QMAKE_CXXFLAGS += -std=c++11
    5. INCLUDEPATH += hpp
    6. DEPENDPATH += hpp
    7.  
    8. HEADERS += \
    9. ...
    10.  
    11. SOURCES += \
    12. ...
    To copy to clipboard, switch view to plain text mode 
    and the test program project exe:
    Qt Code:
    1. TEMPLATE = app
    2. QT = core
    3. TARGET = myapp
    4. QMAKE_CXXFLAGS += -std=c++11
    5. INCLUDEPATH += ../library/hpp hpp
    6. DEPENDPATH += ../library/hpp hpp
    7. LIBS += -L../library -lmylib
    8.  
    9. HEADERS += \
    10. ...
    11.  
    12. SOURCES += \
    13. ...
    To copy to clipboard, switch view to plain text mode 
    This seems to compile. Headers, both in library/hpp and exe/hpp, seem to be found, both libmylib.so and myapp are sitting in their folders, no errors or warnings are reported. But it will not run. IMO, the problem is in the library location.of libmylib.so, is not found at runtime. The problem is that there will be two libmylib.so in the end: one in debug build, one in release build. That's why I do not want to play with LD_LIBRARY_PATH. Is there some option which would say the executable loader where is libmylib.so in the case of debug build and where it is in the case in release build? And a question in advance:

    This project is made as a preparation for dynamic linking shared objects using QLibrary. Which is the best (temporary, before the .so is placed on the libpath) way of specifying the correct path for libmylib.so?

  2. #2
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Multi target projects

    Okay, answering myself. The problem didn't consist in the libpath, it consisted in the executable. The "run" and "debug" commands did not know, which target they should run. They searched an executable in the root project directory, where was no executable. With a multi target project like this, you need to open the "Project" tab, select "Run" and set the right executable. Both run and debug will work.

Similar Threads

  1. QML and serious projects
    By BigSmartFastAndrey in forum General Discussion
    Replies: 1
    Last Post: 27th March 2012, 10:06
  2. Replies: 2
    Last Post: 7th September 2010, 21:19
  3. new projects ???
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 0
    Last Post: 2nd March 2009, 10:21

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.