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. Dll/So: build with static linking
QtWS25 Last Chance

Dll/So: build with static linking

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 2.1k Views
  • 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.
  • S Offline
    S Offline
    sitesv
    wrote on 26 Aug 2020, 13:58 last edited by
    #1

    Hi!
    Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory. With dynamic linking - there is no problem. If build via Visual Studio with static linking - there is no problem as well. Pro file created by default with the C++ Library project type.
    Is it possible to fix this via using Qt Creator??
    Thank you!

    J 1 Reply Last reply 26 Aug 2020, 14:02
    0
    • S sitesv
      26 Aug 2020, 13:58

      Hi!
      Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory. With dynamic linking - there is no problem. If build via Visual Studio with static linking - there is no problem as well. Pro file created by default with the C++ Library project type.
      Is it possible to fix this via using Qt Creator??
      Thank you!

      J Offline
      J Offline
      JohanSolo
      wrote on 26 Aug 2020, 14:02 last edited by
      #2

      @sitesv said in Dll/So: build with static linking:

      Hi!
      Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory.

      There's no point in looking for a .dll when you're building a static library... Static libs on windows are .lib (not to be confused with import libs, which also are .lib).

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      S 1 Reply Last reply 26 Aug 2020, 14:14
      0
      • J JohanSolo
        26 Aug 2020, 14:02

        @sitesv said in Dll/So: build with static linking:

        Hi!
        Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory.

        There's no point in looking for a .dll when you're building a static library... Static libs on windows are .lib (not to be confused with import libs, which also are .lib).

        S Offline
        S Offline
        sitesv
        wrote on 26 Aug 2020, 14:14 last edited by
        #3

        @JohanSolo I need to create a dll without external qt dependencies. Dll loads and got a functions by names (already known) in the runtime of the host application. The host app also built with static linking.
        I need this variant.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JohanSolo
          wrote on 26 Aug 2020, 15:05 last edited by JohanSolo
          #4

          A .dll is not a static lib. You should look at the docs to see how to create a static library.

          I'm not sure whether your problem is that you didn't find the way to build a static lib, of if you're trying to find a .dll file after building a static library...

          Edit: or is it you want to produce a .dll linked statically to Qt?

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          S 1 Reply Last reply 26 Aug 2020, 16:04
          0
          • J JohanSolo
            26 Aug 2020, 15:05

            A .dll is not a static lib. You should look at the docs to see how to create a static library.

            I'm not sure whether your problem is that you didn't find the way to build a static lib, of if you're trying to find a .dll file after building a static library...

            Edit: or is it you want to produce a .dll linked statically to Qt?

            S Offline
            S Offline
            sitesv
            wrote on 26 Aug 2020, 16:04 last edited by
            #5

            @JohanSolo said in Dll/So: build with static linking:

            Edit: or is it you want to produce a .dll linked statically to Qt?

            Yes! It is!

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JohanSolo
              wrote on 26 Aug 2020, 17:52 last edited by
              #6

              OK, then you need a static build of Qt. I guess you followed this. Once you've successfully built your static Qt libs, it's just a matter of linking your library against the various libQtXXX.a. AFAIK (I've never done this myself), there are caveats, for instance you have to use the very same compiler (i.e. exact same version) to compile your library as for the static Qt build.

              @sitesv said in Dll/So: build with static linking:

              Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory.

              Obviously something is going wrong. What does your compiler output tell you? If nothing is produced, I double there are no error messages that could explain this build failure. Please post .pro file and compiler output, so that people here can help. I'm afraid my crystal ball is broken.

              `They did not know it was impossible, so they did it.'
              -- Mark Twain

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cgwolver
                wrote on 16 May 2022, 07:00 last edited by
                #7

                to select cmake instead of qmake as buildsystem, can output dll with qt msvc static.

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cgwolver
                  wrote on 16 May 2022, 10:54 last edited by
                  #8

                  https://doc.qt.io/qt-5/qmake-common-projects.html#building-a-library
                  if you select qmake build dll with static qt, you can add "dll" to "CONFIG" varible in .pro file.

                  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