Results 1 to 7 of 7

Thread: Creation and exploitation libraries

  1. #1
    Join Date
    Mar 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    14

    Default Creation and exploitation libraries

    Hi, I have problem with libraries in qt. When I tried build static and dynamic libraries, qtcreator displayed me some form. I don't know, how I can supplement it.

    If I create some library, How can I load it to my program in qt?

  2. #2
    Join Date
    Mar 2009
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Creation and exploitation libraries

    The Project file for the library should be like this example:

    Qt Code:
    1. PROJECT = project
    2. TARGET = project
    3. TEMPLATE = lib
    4.  
    5.  
    6. VER_MAJ = 1
    7. VER_MIN = 1
    8. VER_PAT = 0
    9. VERSION = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
    10.  
    11. #CONFIG += staticlib
    12. CONFIG += dll
    13.  
    14. DEBUG_SUFFIX =
    15. RELEASE_SUFFIX =
    16.  
    17. DESTDIR = lib
    18. OBJECTS_DIR = build/obj
    19. MOC_DIR = build/moc
    20.  
    21. HEADERS = your headers
    22.  
    23. SOURCES = your sources
    To copy to clipboard, switch view to plain text mode 

    The project that use this library should have this two lines:

    Qt Code:
    1. INCLUDEPATH += path where there are the headers of the library
    2. LIBS += -LPATH -lNAME
    To copy to clipboard, switch view to plain text mode 

    Where:
    PATH is the path where there is the library (.dll or .so or .a or .lib).
    NAME is the name of the file without the extension

    For example, if the library is locate at C:\libs\library.dll you should add this line:

    Qt Code:
    1. LIBS += -LC:\libs -llibrary
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to PaceyIV for this useful post:

    Trok (17th June 2009)

  4. #3
    Join Date
    Mar 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    14

    Default Re: Creation and exploitation libraries

    When I build my library, some form display me. It have 4 text fields as: Name, Executable, Arguments and Working Director with $BUILDDIR. What it mean? How I must supplement it?
    When I already load library to project like you, how can I call function to file?

    Btw: I don't understand your first code ;/ Where I must put it?

  5. #4
    Join Date
    Mar 2009
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Creation and exploitation libraries

    So you don't use QtCreator... I think M$ Visual Studio do the same.
    The Qt project has got a project.pro file with the lists of the headers, sources, configuration settings...

  6. #5
    Join Date
    Mar 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    14

    Default Re: Creation and exploitation libraries

    Yes i know that qtcreator have list in project.pro, but I don't understand last form after built. What's mean "Executable"? How supplement it? ;/

  7. #6
    Join Date
    Mar 2009
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Creation and exploitation libraries

    Ok. The form you're talking is in the section Project, Run settings

    I don't know why Qtcreator shows you this. Maybe he can't find the executable you're compiled. It shows this also for normal project, without external library?

  8. The following user says thank you to PaceyIV for this useful post:

    Trok (17th June 2009)

  9. #7
    Join Date
    Mar 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    14

    Default Re: Creation and exploitation libraries

    PaceyIV thanks for all. When I only build my library it work good. So far I compiled and run it.
    It's deliver.

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
  •  
Qt is a trademark of The Qt Company.