Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How do I compile a .exe file which I can run on any windows computer?
Forum Updated to NodeBB v4.3 + New Features

How do I compile a .exe file which I can run on any windows computer?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
29 Posts 4 Posters 10.9k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #9

    SDL2.DLL looks like its not in the same folder as your application.

    The EXT-MS-WIN can be ignored AFAIK.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    S 1 Reply Last reply
    0
    • SGaistS SGaist

      SDL2.DLL looks like its not in the same folder as your application.

      The EXT-MS-WIN can be ignored AFAIK.

      S Offline
      S Offline
      StevenD
      wrote on last edited by
      #10

      @SGaist Of course it isn't. It's in /QJoysticks/lib/SDL/bin/windows/mingw

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

        And that's your job to copy it over to the folder of your application. windeployqt can't guess where the .dlls are stored. It knows where the Qt dlls are because it's known at installation time, however there's no standard path to look for to get the .dlls. They are not used at all at linking time so it's impossible to know where to look for them.

        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
        2
        • S Offline
          S Offline
          StevenD
          wrote on last edited by
          #12

          I can now launch my .exe after running windeployqt and copying SDL2.dll to the same directory. However, I would still like to get this down to 1 file.

          JKSHJ 1 Reply Last reply
          0
          • S StevenD

            I can now launch my .exe after running windeployqt and copying SDL2.dll to the same directory. However, I would still like to get this down to 1 file.

            JKSHJ Online
            JKSHJ Online
            JKSH
            Moderators
            wrote on last edited by
            #13

            @StevenD said in How do I compile a .exe file which I can run on any windows computer?:

            I can now launch my .exe after running windeployqt and copying SDL2.dll to the same directory. However, I would still like to get this down to 1 file.

            As @SGaist mentioned earlier, the only way to get this down to 1 file is to use static linking. You need to build a statically-linked version of Qt yourself, and then set your project to use the static libraries of Qt and SDL.

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

            1 Reply Last reply
            1
            • S Offline
              S Offline
              StevenD
              wrote on last edited by
              #14

              Right, but how do I build a statically-linked version of Qt? I seem to be missing folders or files from the various tutorials I have found.

              JKSHJ 1 Reply Last reply
              0
              • S StevenD

                Right, but how do I build a statically-linked version of Qt? I seem to be missing folders or files from the various tutorials I have found.

                JKSHJ Online
                JKSHJ Online
                JKSH
                Moderators
                wrote on last edited by
                #15

                @StevenD said in How do I compile a .exe file which I can run on any windows computer?:

                Right, but how do I build a statically-linked version of Qt?

                In summary:

                1. Obtain the Qt source code
                2. Add the -static option when configuring Qt
                3. Build Qt

                Instructions to configure and build are at http://doc.qt.io/qt-5/build-sources.html

                An example set of commands is:

                > configure.bat -prefix "C:/Qt/MyStaticBuild" -opensource -confirm-license -nomake examples -nomake tests -static
                > make
                > make install

                Remember, using static linking means that your application cannot be closed-source.

                I seem to be missing folders or files from the various tutorials I have found.

                Which tutorials, and which folders/files?

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

                1 Reply Last reply
                3
                • S Offline
                  S Offline
                  StevenD
                  wrote on last edited by
                  #16

                  Thanks for the help. I have successfully downloaded the source code, and now have the files that I needed. However, I am having some issues. Mingw is not working.

                  mingw32-make: *** Error -1
                  .   Stop.
                  mingw32-make: *** Waiting for unfinished jobs....
                  

                  ...and then it hangs forever.

                  JKSHJ 1 Reply Last reply
                  0
                  • S StevenD

                    Thanks for the help. I have successfully downloaded the source code, and now have the files that I needed. However, I am having some issues. Mingw is not working.

                    mingw32-make: *** Error -1
                    .   Stop.
                    mingw32-make: *** Waiting for unfinished jobs....
                    

                    ...and then it hangs forever.

                    JKSHJ Online
                    JKSHJ Online
                    JKSH
                    Moderators
                    wrote on last edited by
                    #17

                    @StevenD said in How do I compile a .exe file which I can run on any windows computer?:

                    mingw32-make: *** Error -1
                    

                    There should be more info near this line that describes what the problem is. What was it doing just before the error?

                    Anyway, run mingw32-make again and see if it continues from where it last stopped. (It will first scan the files that have already been processed)

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

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      StevenD
                      wrote on last edited by
                      #18
                      PS C:\Qt-3.0.1\5.9.2\Src> ./configure.bat -opensource -confirm-license -nomake examples -nomake tests -static
                      + cd qtbase
                      + C:\Qt-3.0.1\5.9.2\Src\qtbase\configure.bat -top-level -opensource -confirm-license -nomake examples -nomake tests -static
                      Bootstrapping qmake ...
                      g++ -c -o project.o -DUNICODE -std=c++11 -ffunction-sections -g  -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/library -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/unix -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/win32 -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/mac -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore/5.9.2 -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore/5.9.2/QtCore -I../src/corelib/global -IC:/Qt-3.0.1/5.9.2/Src/qtbase/mkspecs/win32-g++ -DQT_VERSION_STR=\"5.9.2\" -DQT_VERSION_MAJOR=5  -DQT_VERSION_MINOR=9  -DQT_VERSION_PATCH=2  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH C:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/project.cpp
                      mingw32-make: *** Error -1
                      .  Stop.
                      mingw32-make: *** Waiting for unfinished jobs....
                      
                      JKSHJ 1 Reply Last reply
                      0
                      • S StevenD
                        PS C:\Qt-3.0.1\5.9.2\Src> ./configure.bat -opensource -confirm-license -nomake examples -nomake tests -static
                        + cd qtbase
                        + C:\Qt-3.0.1\5.9.2\Src\qtbase\configure.bat -top-level -opensource -confirm-license -nomake examples -nomake tests -static
                        Bootstrapping qmake ...
                        g++ -c -o project.o -DUNICODE -std=c++11 -ffunction-sections -g  -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/library -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/unix -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/win32 -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/mac -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore/5.9.2 -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore/5.9.2/QtCore -I../src/corelib/global -IC:/Qt-3.0.1/5.9.2/Src/qtbase/mkspecs/win32-g++ -DQT_VERSION_STR=\"5.9.2\" -DQT_VERSION_MAJOR=5  -DQT_VERSION_MINOR=9  -DQT_VERSION_PATCH=2  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH C:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/project.cpp
                        mingw32-make: *** Error -1
                        .  Stop.
                        mingw32-make: *** Waiting for unfinished jobs....
                        
                        JKSHJ Online
                        JKSHJ Online
                        JKSH
                        Moderators
                        wrote on last edited by JKSH
                        #19

                        @StevenD said in How do I compile a .exe file which I can run on any windows computer?:

                        PS C:\Qt-3.0.1\5.9.2\Src>
                        

                        I tried to build Qt with PowerShell a few months ago, but it failed. I didn't investigate why, but I suspect it's some kind of incompatibility between PowerShell and the old Batch files.

                        cmd.exe worked for me; see if that helps you.

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

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          StevenD
                          wrote on last edited by
                          #20

                          cmd gives me almost identical output:

                          C:\Qt-3.0.1\5.9.2\Src>configure -opensource -confirm-license -nomake examples -nomake tests -static
                          + cd qtbase
                          + C:\Qt-3.0.1\5.9.2\Src\qtbase\configure.bat -top-level -opensource -confirm-license -nomake examples -nomake tests -static
                          Bootstrapping qmake ...
                          g++ -c -o project.o -DUNICODE -std=c++11 -ffunction-sections -g  -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/library -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/unix -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/win32 -IC:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/generators/mac -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore/5.9.2 -IC:/Qt-3.0.1/5.9.2/Src/qtbase/include/QtCore/5.9.2/QtCore -I../src/corelib/global -IC:/Qt-3.0.1/5.9.2/Src/qtbase/mkspecs/win32-g++ -DQT_VERSION_STR=\"5.9.2\" -DQT_VERSION_MAJOR=5  -DQT_VERSION_MINOR=9  -DQT_VERSION_PATCH=2  -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH C:/Qt-3.0.1/5.9.2/Src/qtbase/qmake/project.cpp
                          mingw32-make: *** Error -1
                          .  Stop.
                          mingw32-make: *** Waiting for unfinished jobs....
                          
                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #21

                            I'd first cleanup to ensure there's no remaining from your old build tentative.

                            Also, consider doing out of source builds, that will simplify things if you want to build Qt for several architectures or make different static/shared builds.

                            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
                            • S Offline
                              S Offline
                              StevenD
                              wrote on last edited by
                              #22

                              What should I clean up? Attempting to run mingw32-make clean results in mingw32-make: *** No rule to make target 'clean'. Stop.

                              In addition, I do not see any additional files I should delete.

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

                                Because you are calling configure repeatedly with different options, so you should cleanup between invocation.

                                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
                                • S Offline
                                  S Offline
                                  StevenD
                                  wrote on last edited by
                                  #24

                                  I know I should clean, but what and how do I clean?

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • S StevenD

                                    I know I should clean, but what and how do I clean?

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by jsulm
                                    #25

                                    @StevenD You should start with fresh Qt source tree and do out of source build as @SGaist suggested.
                                    Out of source means:

                                    c:\qt_source
                                    mkdir c:\qt_build
                                    cd c:\qt_build
                                    ..\qt_source\configure.exe...
                                    make
                                    

                                    So, basically you call configure and make from outside of the Qt source code directory.
                                    In general you should read http://doc.qt.io/qt-5/build-sources.html

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      StevenD
                                      wrote on last edited by
                                      #26

                                      Right, I now have a different problem:

                                      C:\qt_build>..\Qt-3.0.1\5.9.2\Src\configure -opensource -confirm-license -nomake examples -nomake tests -static
                                      + cd qtbase
                                      + C:\Qt-3.0.1\5.9.2\Src\qtbase\configure.bat -top-level -opensource -confirm-license -nomake examples -nomake tests -static
                                      Host platform 'win32-g++' is invalid. Aborting.
                                      
                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #27

                                        From a clean source ?
                                        What command prompt are you using ?

                                        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
                                        • S Offline
                                          S Offline
                                          StevenD
                                          wrote on last edited by
                                          #28

                                          I've tried using cmd and PowerShell, in that order. Both give the same ouput.

                                          This may be a problem with Windows. I've recently started having... issues with it that are not related to Qt. Random applications suddenly can't run on my pc... I had this pop up with Qt Creator, Cygwin, and some other things.

                                          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