RandumbTune RandumbTune - 2 months ago 14x
C++ Question

Adding external library(C++) to QT project

I have managed to get a basic small application working, now I am trying to add some external libraries to the project.
I have referred to many examples, for example like this one: http://doc.qt.io/qt-5/third-party-libraries.html
But my issue is, how do I add a library which does not has any pre-complied binary, i.e a ".lib" or ".a" file ? How do I generate one ?

For example I would like to use a libssh library, and all the files I got in the package were: enter image description here


You have two choices: to build it from source, or to use the pre-compiled package, if it is available for your OS and distribution.

For the first option, if you will look inside your source folder (the screenshot you attached), you will see the CMakeLists.txt. This is the file that will help you to perform the build by using CMake program. To sum up, the build would require running two commands: cmake and make. I found this file: https://github.com/substack/libssh/blob/master/INSTALL that explans the building steps in more detail, so I recommend following it.

For the second option, I found on this page: if you are using openSUSE, SUSE Linux Enterprise or Fedora (I assume you are on Linux), there are rpm packages for you to use. If not, than building from source is the only option for you.

After it is built, you can follow the Qt guide you mentioned in the question.