Qt Forum

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

    Unsolved Dll/So: build with static linking

    General and Desktop
    3
    8
    765
    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.
    • sitesv
      sitesv last edited by

      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!

      JohanSolo 1 Reply Last reply Reply Quote 0
      • JohanSolo
        JohanSolo @sitesv last edited by

        @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

        sitesv 1 Reply Last reply Reply Quote 0
        • sitesv
          sitesv @JohanSolo last edited by

          @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 Reply Quote 0
          • JohanSolo
            JohanSolo last edited by JohanSolo

            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

            sitesv 1 Reply Last reply Reply Quote 0
            • sitesv
              sitesv @JohanSolo last edited by

              @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 Reply Quote 0
              • JohanSolo
                JohanSolo last edited by

                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 Reply Quote 0
                • C
                  cgwolver last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • C
                    cgwolver last edited by

                    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 Reply Quote 0
                    • First post
                      Last post