Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. C ++ dll import qt project
Forum Updated to NodeBB v4.3 + New Features

C ++ dll import qt project

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 5 Posters 2.3k Views 5 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.
  • H Offline
    H Offline
    hancan007
    wrote on 5 Jul 2021, 08:12 last edited by
    #1

    How to import c++ dll into the qt project

    K A 2 Replies Last reply 5 Jul 2021, 08:14
    0
    • H hancan007
      5 Jul 2021, 08:12

      How to import c++ dll into the qt project

      K Offline
      K Offline
      KroMignon
      wrote on 5 Jul 2021, 08:14 last edited by
      #2

      @hancan007 Which build system are you using, qmake or cmake?

      https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hancan007
        wrote on 6 Jul 2021, 13:36 last edited by
        #3

        qmake

        aca6de57-3fda-42dc-b683-22e221258a3c-image.png

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JKSH
          Moderators
          wrote on 6 Jul 2021, 13:43 last edited by
          #4

          https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hancan007
            wrote on 6 Jul 2021, 13:48 last edited by
            #5

            should i choose internal lib. Because I want to add ".dll" but qt is looking for my additions as ".lib"

            J 1 Reply Last reply 6 Jul 2021, 14:02
            0
            • H hancan007
              5 Jul 2021, 08:12

              How to import c++ dll into the qt project

              A Offline
              A Offline
              artwaw
              wrote on 6 Jul 2021, 14:01 last edited by
              #6

              @hancan007 being sure that the external library is compiled accordingly just add external dynamic library, remember to set INCLUDENPATH in the pro file and #include the header file where appropriate in your code.

              If Qt is offering you lib file then most likely you are looking for the static one.

              For more information please re-read.

              Kind Regards,
              Artur

              1 Reply Last reply
              0
              • H hancan007
                6 Jul 2021, 13:48

                should i choose internal lib. Because I want to add ".dll" but qt is looking for my additions as ".lib"

                J Offline
                J Offline
                JKSH
                Moderators
                wrote on 6 Jul 2021, 14:02 last edited by
                #7

                @hancan007 said in C ++ dll import qt project:

                should i choose internal lib.

                Choose "Internal Library" if the library is part of your project.

                Choose "External Library" if the library is outside your project.

                I want to add ".dll" but qt is looking for my additions as ".lib"

                Usually a DLL comes with a .lib file and a .h file.

                If you don't have a .lib file -- where did you get this DLL from?

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hancan007
                  wrote on 6 Jul 2021, 14:05 last edited by
                  #8

                  i have a .h file, but qt is looking for .lib instead of using .h

                  M 1 Reply Last reply 6 Jul 2021, 14:25
                  0
                  • H hancan007
                    6 Jul 2021, 14:05

                    i have a .h file, but qt is looking for .lib instead of using .h

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 6 Jul 2021, 14:25 last edited by mrjj 7 Jun 2021, 14:26
                    #9

                    @hancan007

                    Hi
                    The .h defines what can be called and classes
                    The LIB file tells what DLL has exported
                    The DLL contains the actual code.

                    So it can't just use the H.
                    It needs all of it to work.

                    And most important the DLL must be made with a compatible compiler to what your app is using.

                    So if made with visual studio, you cannot use MinGW and reverse.

                    1 Reply Last reply
                    2
                    • H Offline
                      H Offline
                      hancan007
                      wrote on 6 Jul 2021, 14:38 last edited by
                      #10

                      I found the .lib file how should I add it to my project

                      M J 2 Replies Last reply 6 Jul 2021, 14:57
                      0
                      • H hancan007
                        6 Jul 2021, 14:38

                        I found the .lib file how should I add it to my project

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 6 Jul 2021, 14:57 last edited by
                        #11

                        @hancan007
                        Since there is a dll, i think its dynamic

                        So points to the LIB file and see. it should tell it to load the DLL at run time.

                        but this only works if same compilers.

                        1 Reply Last reply
                        0
                        • H hancan007
                          6 Jul 2021, 14:38

                          I found the .lib file how should I add it to my project

                          J Offline
                          J Offline
                          JKSH
                          Moderators
                          wrote on 6 Jul 2021, 15:12 last edited by
                          #12

                          @hancan007 said in C ++ dll import qt project:

                          I found the .lib file how should I add it to my project

                          Earlier you said 'I want to add ".dll" but qt is looking for my additions as ".lib"'. So tell Qt Creator where to find your .lib file.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          0

                          1/12

                          5 Jul 2021, 08:12

                          • Login

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