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. Qt Statically build on Windows
QtWS25 Last Chance

Qt Statically build on Windows

Scheduled Pinned Locked Moved General and Desktop
12 Posts 5 Posters 3.4k 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.
  • A Offline
    A Offline
    anmol2701
    wrote on last edited by
    #1

    I have created an applications on Linux and have built them statically successfully.

    I am trying to do the same thing in windows but I am not able to build staticaly.

    I have installed the QtSDK and designed my application in the QtCreator in Windows. The compiler I am using is MSVC2010 32bit.

    First of all i get the error " Failed to start program. Path or permissions wrong?"

    What is the proper way to resolve this error?

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

      Hi,

      You would first need to also build Qt statically on windows

      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
      0
      • A Offline
        A Offline
        anmol2701
        wrote on last edited by
        #3

        Thanks for the reply.

        Moreover, After resolve the last error.
        My application is running with qt But it is not running with out qt.
        An error occured "Qt5widgets.dll not found".
        I go through lots of forum but not able to resolve it.

        1 Reply Last reply
        0
        • IamSumitI Offline
          IamSumitI Offline
          IamSumit
          wrote on last edited by
          #4

          Hiii.

          if you are going to run .exe (without qt) you need to copy a file
          “Qt5widgets.dll from C:\Qt\Qt5.0.1\5.0.1\bin:
          and paste it to release folder .

          Be Cute

          1 Reply Last reply
          0
          • A Offline
            A Offline
            anmol2701
            wrote on last edited by
            #5

            Even this method is not working..

            i copied .dll file from C:\Qt\Static\5.2.0\bin\5.0.2\msvc2010\bin to release folder

            1 Reply Last reply
            0
            • IamSumitI Offline
              IamSumitI Offline
              IamSumit
              wrote on last edited by
              #6

              Hii
              this could provide you more help
              http://qt-project.org/wiki/Deploy_an_Application_on_Windows

              Be Cute

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MuldeR
                wrote on last edited by
                #7

                If you really built Qt as "static" libraries - which you need to do yourself (since the "official" pre-compiled Qt binaries are always "shared") - and if you link your application against all the relevant "static" libraries, then the resulting executable won't depend on any Qt DLL's at runtime.

                But if you get a message like “Qt5widgets.dll not found”, it means you did not build your application with "static" Qt libraries. Also it means that “Qt5widgets.dll" (or some additional DLL required by that DLL) is missing in your DLL Search Path. See "Dynamic-Link Library Search Order":http://goo.gl/VA8yC!

                Finally, I highly recommend using the awesome "Dependency Walker":http://www.dependencywalker.com/ tool to resolve your DLL dependency issues.

                My OpenSource software at: http://muldersoft.com/

                Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                Go visit the coop: http://youtu.be/Jay...

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  anmol2701
                  wrote on last edited by
                  #8

                  Thanks for your reply..

                  Now I got fresh machine with windows 7 and visual studio 2010.

                  Can anybody Share any link to install static Qt on windows or way to install fresh Qt.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    There's no static Qt installer, you have to do that yourself.

                    For a standard install just go to the download page and get the e.g. the online installer. Choose the VS2010 packages when selecting what to install

                    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
                    0
                    • guidupasG Offline
                      guidupasG Offline
                      guidupas
                      wrote on last edited by
                      #10

                      There are softwares that recognize what libraries you need to run the app out. "Dependency walker":http://www.dependencywalker.com/ is a good one.

                      You can also use installers like "Inno Setup":http://www.jrsoftware.org/isinfo.php

                      Cheers

                      Att.
                      Guilherme Cortada Dupas

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        anmol2701
                        wrote on last edited by
                        #11

                        Hello everyone,

                        I followed the following steps using source code of Qt 4.7.3.

                        1. I have installed the visual-studio-add-in

                        2. Extract the Qt source code to C:\qt\4.7.3.static

                        3. Add the folder above to environment variables

                          QTDIR = C:\qt\4.7.3.static

                          Also append the qt location to path variable

                        4. Then Change the target configuration.

                        Edit the file mkspecs\win32-msvc2010\qmake.conf and replace

                        QMAKE_CFLAGS_RELEASE = -O2 -MD with -O2 -MT
                        QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi with -O2 -MT -Zi
                        QMAKE_CFLAGS_DEBUG = -Zi -MDd with -Zi -MTd

                        and save it.

                        1. Open the Visual Studio command prompt and navigate to QTDIR

                        2. Run configure

                        configure -static -debug-and-release -opensource -no-qt3support -qt-sql-sqlite -phonon -phonon-backend -platform win32-msvc2010

                        Accept the license with ‘y’ and wait while Qt is getting configured.

                        1. Run nmake to start compiling

                        nmake

                        1. Start VS2010

                        Go to Qt-> Qt-Options add the just compiled Qt version found within the QTDIR folder.

                        Now I can compile Qt code using Microsoft Visual Studio.
                        It compile Statically.

                        It is working as a option of Microsoft Visual Studio.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Before changing MD to MT, please read carefully about the implications from doing it.

                          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
                          0

                          • Login

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