PDA

View Full Version : using third party libs



jay
1st April 2009, 12:07
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.

jay
1st April 2009, 12:29
will QLibrary class help me for doing this?

spirit
1st April 2009, 12:38
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 (http://doc.trolltech.com/4.5/qmake-variable-reference.html#libs). 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.

talk2amulya
1st April 2009, 12:41
its better to add the entries in the pro file. Here's how:


LIBS += -L"PathToLibDirectory" -l"libraryName"

this will work on all OS. Hail the Qt!

jay
1st April 2009, 13:01
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) ?

talk2amulya
1st April 2009, 13:05
yes, then in your pro file, u'll need to make OS specific entries, like:

win32
{
//Libs entry
}

unix
{
//Libs entry
}

mac
{
//Libs entry
}

spirit
1st April 2009, 13:36
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.

jacky
13th April 2009, 11:09
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.

adamatic
14th April 2009, 09:26
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-variable-reference.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!!

adamatic
14th April 2009, 12:34
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?

spud
14th April 2009, 14:48
That should be
LIBS+= -L"c:/library" -l"api_mil"

adamatic
14th April 2009, 15:31
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!! :eek:

spud
14th April 2009, 15:45
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.

adamatic
14th April 2009, 15:52
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.