Results 1 to 14 of 14

Thread: using third party libs

  1. #1
    Join Date
    Feb 2008
    Posts
    60
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default using third party libs

    I am having a third party SDK (libs and dlls)
    [the doc saying that this SDK is used in Linux and MAC as well]

    1. can anyone help me to how to include these libs with my Qt application.
    Windows: adding LIBS += <lib name> into the .pro file is enough?

    2. May I know how this could be done in other OS(linux and MAC)

    If anyone tried like this before. help me.

    Thanks in advance.

  2. #2
    Join Date
    Feb 2008
    Posts
    60
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using third party libs

    will QLibrary class help me for doing this?

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using third party libs

    Quote Originally Posted by jay View Post
    1. can anyone help me to how to include these libs with my Qt application.
    Windows: adding LIBS += <lib name> into the .pro file is enough?
    yes, this is enough for all platform. read this. then you need to include needed h-file in your sources for using objects from 3d-party library.
    but this approach is ok when you have static library and dynamic link library.

    if you have olny dynamic link library then you have to use QLibrary.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. The following user says thank you to spirit for this useful post:

    jacky (13th April 2009)

  5. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using third party libs

    its better to add the entries in the pro file. Here's how:

    Qt Code:
    1. LIBS += -L"PathToLibDirectory" -l"libraryName"
    To copy to clipboard, switch view to plain text mode 

    this will work on all OS. Hail the Qt!

  6. The following user says thank you to talk2amulya for this useful post:

    jacky (13th April 2009)

  7. #5
    Join Date
    Feb 2008
    Posts
    60
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using third party libs

    Happy to see the Quick replies from this forum.

    many thanks for both of you.

    I never included libs in other platforms(MAC and Linux) before.

    Now, I am having only .dll & .lib and a header(.h) files.
    So I should get the equivalent for other OS? ( .so for Linux and .dylib for MAC) ?

  8. #6
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using third party libs

    yes, then in your pro file, u'll need to make OS specific entries, like:

    win32
    {
    //Libs entry
    }

    unix
    {
    //Libs entry
    }

    mac
    {
    //Libs entry
    }

  9. The following user says thank you to talk2amulya for this useful post:

    jay (3rd April 2009)

  10. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using third party libs

    Quote Originally Posted by jay View Post
    Happy to see the Quick replies from this forum.

    many thanks for both of you.

    I never included libs in other platforms(MAC and Linux) before.

    Now, I am having only .dll & .lib and a header(.h) files.
    So I should get the equivalent for other OS? ( .so for Linux and .dylib for MAC) ?
    that's described in link which I've posted.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  11. The following user says thank you to spirit for this useful post:

    jay (3rd April 2009)

  12. #8
    Join Date
    Apr 2009
    Posts
    15
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using third party libs

    I am newbie in QT.
    I have a Win32 static lib file without source code and header file and I have to use it in QT.
    I try to make its header file but it seems incorrect and the compiler says "Undefine reference to 'A::A()'".
    I guess I need a tool to generate the header for a static lib to use in QT but I don't know.
    Thanks for any advices from you.

  13. #9
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using third party libs

    Hello.

    I am trying to include a external lib too, i have read different posts and I have used some alternatives but anyone is working.

    T think the righit way is including the lib as the link http://doc.trolltech.com/4.5/qmake-v...ence.html#libs tells, including the variables as tell this onehttp://www.brindusescu.org/?q=node/26 , and nothing.

    I am beginning to think I should modify the Makefile file. should i do?

    I am using Windows XP, a Qt project on Eclipse and Mingw as compiler.

    Cheers!!

  14. #10
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using third party libs

    Hi again.

    I am writing LIBS+= c:/library/api_mil.lib to the .pro file of my project and when i built the project the comipiler says :

    cannot find c:/library/api_mil.lib

    Please does anyone know what I am doing wrong?

  15. #11
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using third party libs

    That should be
    Qt Code:
    1. LIBS+= -L"c:/library" -l"api_mil"
    To copy to clipboard, switch view to plain text mode 

  16. #12
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using third party libs

    I am doing this and I obtaine the following error:

    C:/library/api_mil.lib: file not recognized: File format not recognized

    I am getting crazy!!

  17. #13
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using third party libs

    Oh, you are using Mingw. Mingw expects .a files not .lib. I don't think you can simply link to a lib compiled with MSVC. Somebody please correct me if I am wrong.
    Last edited by spud; 14th April 2009 at 16:45. Reason: spelling error

  18. #14
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using third party libs

    Aaahm ok, I can see...

    And there is no way to convert the .lib in a .a? or maybe I could use the dll file of the API which I have it too.

    This is to not change the compiler, because i have all the Eclipse configuration with Mingw.

Similar Threads

  1. Replies: 7
    Last Post: 8th May 2009, 11:26
  2. Linking against different Libs
    By AlphaWolf in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2009, 16:25
  3. problem with order of libs during linking
    By minimax in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2008, 11:32
  4. Including libs on windows
    By ucomesdag in forum Qt Programming
    Replies: 2
    Last Post: 17th August 2007, 09:31
  5. Bad relink libs on QT4 Mac OSX (install_name_tool)
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2007, 10:01

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.