Third party lib : Best way
I want to use above with QT. What is best way to use it.
I mean INCLUDEPATH or adding all files in QT. I want use this third party library in perfect way.
Please share your thoughts and knowledge.
I would go for dynamic linking against a library whenever possible. It reduces your workload as you can just use prebuild packages of the library (if available). (Linux-) distributors tend to prefer having applications use shared libraries over shipping their own versions, too. That reduces the workload for them: If libz has a security issue then they can fix it there and all the programs depending on the functionality provided by that library are fixed, too. When you include your own version of libz then they have to remember to fix the issue in your version (or at least check whether the issue is actually effecting your libz... you could have patched the issue yourself before or be using an old version that did not have the issue, etc.).
Making a existing library a part of your own software by putting it into your own sources provides some advantages too: It gives you full control over the exact sources of the library used and you can apply patches when needed. The first can be really valuable if the included library is still heavily changing by providing a more stable development environment. Of course you still need to follow the upstream changes, but at least you can do it when your own schedule allows for it, not when somebody else thinks it is a good idea to update. The latter is valuable if upstream is slow at accepting patches.
Of course you have to make sure upstream updates are merged back into your codebase. These updates might even effect the security of your application, so constant monitoring of the upstream library is required. This gets more and more complicated as your version and the one provided by upstream diverge: Making sure your patches are merged by the library developers as soon as possible is a must in my experience.
Another downside of shipping a 3rd party library as part of your code is the confusion it creates with possible contributers: Is it ok to clean up the code there or should it be left alone as much as possible? Where should bugs in that part of the code get reported to? Is the version you are shipping identical to some released version of the library or heavily patched?
I know QT very well just bit not sure how c++ lib behaves.
Like dynamic linking for XLSLIB (When I do configure,make,make install I got xlslib.la on ubuntu).
Is this can be on windows. What is complied library . I feel this is DLL in windows in linux never sure about extension like it can be .a ,.la ,*.o
So I need to Visual Studio to get that DLL for XLSLIB or QTCREATOR can do magic?
*Thank you for your wonderful explanation *
Qt is a C++ library, so if you know Qt you know C++ libraries:-)
You should have gotten a libNAME.so. The .la file is just a wrapper generated by libtool, not the library itself. .o are object files which are generated by the compiler and then linked into the final binary.
How to build a library on windows depends on the library's build system. Please check the README that came with the library. Of course you can use Qt Creator to build it (Qt Creator supports generic make-based projects, cmake and qmake, so most are covered).
Please be advised that you can not mix and match MSVC and mingw build libraries.
Dynamic linking use to be the best way for those well-known libraries.
I wouldn't change your include_path if that library exports a pkgconfig file. if so, just put the code bellow in your .pro file:
CONFIG += link_pkgconfig
PKGCONFIG = xls
ok great I got *.a file
*.lib are Visual studio generated
*.a are gcc generated
MinGW's static (import) libs have .a extension. MSVC's static (import) libs have .lib extension.
Am I right? And Can we use *.a files(lib) on windows based project. Or we need *.lib files only.
Yes there is some pkgconfig but in makefile only. No seperate files.
Thank you Tobias Hunger and danilocesar for helping a nerd.
bye the way I know QT contains c++ libraries but you don't need worry how they will complie :)
@Can we use *.a files(lib) on windows based project.@
No we can't we've to use lib
Problem solved :)