Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. generate a library and use it in a project
Forum Updated to NodeBB v4.3 + New Features

generate a library and use it in a project

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 2 Posters 530 Views 2 Watching
  • 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.
  • R Offline
    R Offline
    Rouja
    wrote on last edited by
    #1

    Hello,
    I am new to Qt. I am facing a problem to do a task.
    Well, I have a .cpp file and its header. I would like to build them using the .pro and .pri files and than, I need to use this library in my project.
    Well, I don't know how to build it and how to call it in the .pri file of the project. Can anyone help me?

    1 Reply Last reply
    0
    • R Rouja

      Hello, thank you for your response. In fact, I have a .cpp filee and its header that musn't be included in the project and these files are required to be used in some modules of the project. If I create a library with the needed file and I link my project to this lib will I be in the right path?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #4

      @Rouja

      So it is a requirement that those .cpp and .h is not compiled with the project?

      If yes ( even i dont understand why excatly )
      then surely a library is the way to go.
      You can then compile it once and then only link the so/dll to the app.

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #2

        Hi And welcome to the forums

        This tut shows how to make a lib and use it
        https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application

        That said, you do need a basic understanding of dlls/so files and linking and such.

        But else just ask here. Good questions get good answers.

        Also since you talk about a pri file. Are you sure you want it as a library as using a pri file sounds a bit more like a sub project.
        Both can do the same but using a pri file is vastly easier than making a lib and linking to that. :)

        1 Reply Last reply
        3
        • R Offline
          R Offline
          Rouja
          wrote on last edited by
          #3

          Hello, thank you for your response. In fact, I have a .cpp filee and its header that musn't be included in the project and these files are required to be used in some modules of the project. If I create a library with the needed file and I link my project to this lib will I be in the right path?

          mrjjM 1 Reply Last reply
          0
          • R Rouja

            Hello, thank you for your response. In fact, I have a .cpp filee and its header that musn't be included in the project and these files are required to be used in some modules of the project. If I create a library with the needed file and I link my project to this lib will I be in the right path?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #4

            @Rouja

            So it is a requirement that those .cpp and .h is not compiled with the project?

            If yes ( even i dont understand why excatly )
            then surely a library is the way to go.
            You can then compile it once and then only link the so/dll to the app.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rouja
              wrote on last edited by
              #5

              This is exactly what I need. But, is there a tuto or a doc that can help me ?

              mrjjM 1 Reply Last reply
              0
              • R Rouja

                This is exactly what I need. But, is there a tuto or a doc that can help me ?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #6

                @Rouja
                yes the link i showed
                https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application

                it also shows how to load the library and resolve symbols meaning
                how to use it / call functions in it and so on.

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Rouja
                  wrote on last edited by
                  #7

                  Thank you very much

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved