Qt6 topics merged with General

Install and Link Third Party Libraries in Qt Application

  • Regards.

    I'm building a Qt application which also use OpenCV (and this in turn, is built with support for Intel TBB). So far I have worked with my installation of OpenCV in "/usr/lib" and "/usr/include" on Linux and in "C:\opencv" on Windows.

    Now, I want to work with all the libraries I'm using contained within the home directory of my application. So, I created a directory '3rdparty' in which I created a directory opencv. Within this last directory, I put the OpenCV include files and dynamic link libraries for the opencv modules I'm using; namely core, imgproc and highgui (.so for Linux and .dll for Windows, each group in a corresponding subdirectory).

    My doubts are:

    1. Is right I want to do ?, that is, to want to have all external dependencies of my application hosted "local" to put it one way.

    2. I need to copy the dynamic link library file (.so / .dll) to the directory where my application is built. How can I specify that in the .pro file?

    Regarding this question (and as I've never done anything like this before), I think the copy of the files should be made before running the QMake's generated makefile, because the application must link to those libraries ... I'm wrong?.
    How can I specific such thing in the .pro file?

    1. What are the rules for link such library files, considering the point in my previous question?

    Thanks in advance for any help and/or suggestions.

  • Lifetime Qt Champion


    You don't need to copy the libraries to link to them. You can simply add the 3rdparty include + lib paths to the corresponding variables in you pro file.

Log in to reply