Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to use Qt libraries in a non-Qt project

    Installation and Deployment
    4
    9
    71
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wasawi2 last edited by

      Dear all,

      I have a C++ project in QtCreator that uses a qbs file to setup all libraries included in the project. The project works well as it is.
      I am working on MacOS Ventura and I would like to use Qt widgets and Qt windowing system as an interface but I don't know how to link Qt headers and frameworks to the project.

      Could anyone provide any hints?

      Thank you very much,
      w

      Christian Ehrlicher 1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion @wasawi2 last edited by

        @wasawi2 said in How to use Qt libraries in a non-Qt project:

        Could anyone provide any hints?

        Use a proper build system like qbs, qmake or cmake and let those apps do the work for you finding and linking the correct libs.

        Qt has to stay free or it will die.

        jsulm 1 Reply Last reply Reply Quote 0
        • jsulm
          jsulm Lifetime Qt Champion @Christian Ehrlicher last edited by

          @Christian-Ehrlicher "I have a C++ project in QtCreator that uses a qbs"

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Christian Ehrlicher 1 Reply Last reply Reply Quote 0
          • Christian Ehrlicher
            Christian Ehrlicher Lifetime Qt Champion @jsulm last edited by

            @jsulm So where is the problem then?

            Qt has to stay free or it will die.

            jsulm 1 Reply Last reply Reply Quote 0
            • jsulm
              jsulm Lifetime Qt Champion @Christian Ehrlicher last edited by

              @Christian-Ehrlicher How to add Qt libs to the project (I never used QBS, so don't have an answer).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Hi,

                Did you already went through the Qbs introduction ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                W 1 Reply Last reply Reply Quote 0
                • W
                  wasawi2 @SGaist last edited by

                  @SGaist thank you very much for the suggestion.

                  I had a look at it but it seems to have an overwhelming amount of information.
                  It would be great if someone could give a bit of guidance. My guess is that including Qt libraries must be a matter of 5 to 10 lines of QBS code, am I right?

                  If anyone can give a little help it would be very much appreciated.

                  Thank you,
                  w

                  SGaist 1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion @wasawi2 last edited by

                    @wasawi2 did you try the minimal hello world hinted on that page linked ?

                    Application {
                        name: "helloworld"
                        files: ["main.cpp"]
                        Depends { name: "Qt.core" }
                        Depends { name: "cpp" }
                        cpp.optimization: "ludicrousSpeed"
                    }
                    

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply Reply Quote 0
                    • W
                      wasawi2 last edited by

                      thank you,
                      At the end It was just including these few lines what made the trick.
                      I don't understand at all how QtCreator finds the header files and frameworks but it seems to work out.

                      Thanks again,
                      w

                              Depends { name: "Qt.core" }
                              Depends { name: "Qt.widgets" }
                              Depends { name: "Qt.gui" }
                              Depends { name: "Qt.opengl" }
                      
                      
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post