Results 1 to 5 of 5

Thread: building and using a library

  1. #1
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default building and using a library

    Hi,
    I would like to find a basic example on how to build a library and use it in a program with Qt creator debugger mode. All my attempt have failed so far even with other people postings I could not get a clear step by step procedure that work.

    Thanks

  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: building and using a library

    What part of this are you experiencing difficulty with?

    This has all been covered numerous times in this forum and based on having at least a basic understanding of how programs are compiled/linked.
    Last edited by ChrisW67; 6th January 2012 at 02:21.

  3. #3
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: building and using a library

    the library seems to build properly(no errors), the i copy the liblibrary2.a, library2.dll and header files in the "includepath" folder of my program, the .pro looks like this:
    QT += core gui

    TARGET = TEST3
    TEMPLATE = app

    INCLUDEPATH = C:/QtSDK/Examples/4.7/mainwindows/test/library2

    SOURCES += main.cpp\
    mainwindow.cpp
    LIBS+= -LC:/QtSDK/Examples/4.7/mainwindows/test/library2 -lliblibrary2

    HEADERS += mainwindow.h

    when i attempt to build i get this error:
    c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lliblibrary2
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug\TEST3.exe] Error 1
    mingw32-make: *** [debug] Error 2
    FORMS += mainwindow.ui

    if i remove liblibrary.a from the folder then it complains about undefined class...

    thanks for your help

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: building and using a library

    -lliblibrary2
    Seems that there is a "lib" too much...

  5. #5
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: building and using a library

    i swear I tried this before! seems to work fine now, much to learn I have...

    sorry about the rookie question and thanks for replying

Similar Threads

  1. source building a standard gnu library
    By felix in forum Qt Tools
    Replies: 0
    Last Post: 5th March 2009, 17:40
  2. Library and Subdirs building problem
    By herenbdy in forum Qt Programming
    Replies: 2
    Last Post: 10th July 2008, 02:10
  3. Building a library with qmake
    By wallyqt in forum Qt Programming
    Replies: 3
    Last Post: 22nd November 2007, 14:17
  4. Building qt program with static library
    By JonathanForQT4 in forum Newbie
    Replies: 2
    Last Post: 22nd June 2007, 23:15
  5. Building a third party library
    By munna in forum General Programming
    Replies: 1
    Last Post: 6th October 2006, 20:43

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.