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. Build exe-file of Qt4-Project
Forum Updated to NodeBB v4.3 + New Features

Build exe-file of Qt4-Project

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
37 Posts 5 Posters 11.5k Views 3 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.
  • M Offline
    M Offline
    magguz
    wrote on last edited by magguz
    #1

    Hi,

    how can I deploy a Qt4-Project under Windows so I get a stand-alone exe-file? I tried already to build my Qt-installation static, as I read in different documentations on the internet. But this doesn't work and is very complicated. So does anybody know a way how I can get an exe-file of my project under Windows?

    aha_1980A K 2 Replies Last reply
    0
    • M magguz

      Hi,

      how can I deploy a Qt4-Project under Windows so I get a stand-alone exe-file? I tried already to build my Qt-installation static, as I read in different documentations on the internet. But this doesn't work and is very complicated. So does anybody know a way how I can get an exe-file of my project under Windows?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @magguz

      You have to build Qt statically.

      Qt has to stay free or it will die.

      1 Reply Last reply
      0
      • M magguz

        Hi,

        how can I deploy a Qt4-Project under Windows so I get a stand-alone exe-file? I tried already to build my Qt-installation static, as I read in different documentations on the internet. But this doesn't work and is very complicated. So does anybody know a way how I can get an exe-file of my project under Windows?

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        @magguz

        As you already found out you need Qt static libraries in order to obtain a single exe file. However, you need to be aware of the license issues involved especially the restrictions for distribution of your application.

        There is no way around creating the static libraries yourself. I understand that some users consider it a bit annoying to have to wait depending on the CPU power available, but the configure process I can describe only as straightforward. I have done a couple of compilations of Qt 5 with MinGW 64 bit just before Christmas.

        Also compilation of Qt 4 is basically the same as far as I remember.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        2
        • M Offline
          M Offline
          magguz
          wrote on last edited by
          #4

          Hi,

          I followed these instructions:

          http://doc.qt.io/archives/qt-4.8/deployment-windows.html

          to build Qt statically. But at the step where nmake is invoked my system can't find the command nmake.

          JKSHJ K 2 Replies Last reply
          0
          • M magguz

            Hi,

            I followed these instructions:

            http://doc.qt.io/archives/qt-4.8/deployment-windows.html

            to build Qt statically. But at the step where nmake is invoked my system can't find the command nmake.

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            @magguz said in Build exe-file of Qt4-Project:

            at the step where nmake is invoked my system can't find the command nmake.

            How do you compile programs from the command line?

            The document says, "...we have used nmake in all the examples, but if you use MinGW you must use mingw32-make instead."

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

            1 Reply Last reply
            0
            • M magguz

              Hi,

              I followed these instructions:

              http://doc.qt.io/archives/qt-4.8/deployment-windows.html

              to build Qt statically. But at the step where nmake is invoked my system can't find the command nmake.

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              @magguz

              You have to set the path environment variable to include the folder where your compiler is.

              set PATH=C:\Users\blablabla\AppData\Local\Programs\Python\Python36-32\;c:\MinGW64\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
              

              I needed to add the path of MinGW and created a bat-file for this. When you start the bat in a command prompt it will be only available until you close the prompt. Checkout where your visual studio with nmake is installed. IIRC it should be also a bin folder. You need to replace the MinGW part. Above I have added also an entry to python.

              Vote the answer(s) that helped you to solve your issue(s)

              M 1 Reply Last reply
              0
              • K koahnig

                @magguz

                You have to set the path environment variable to include the folder where your compiler is.

                set PATH=C:\Users\blablabla\AppData\Local\Programs\Python\Python36-32\;c:\MinGW64\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
                

                I needed to add the path of MinGW and created a bat-file for this. When you start the bat in a command prompt it will be only available until you close the prompt. Checkout where your visual studio with nmake is installed. IIRC it should be also a bin folder. You need to replace the MinGW part. Above I have added also an entry to python.

                M Offline
                M Offline
                magguz
                wrote on last edited by
                #7

                @koahnig said in Build exe-file of Qt4-Project:

                @magguz

                You have to set the path environment variable to include the folder where your compiler is.

                set PATH=C:\Users\blablabla\AppData\Local\Programs\Python\Python36-32\;c:\MinGW64\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
                

                I needed to add the path of MinGW and created a bat-file for this. When you start the bat in a command prompt it will be only available until you close the prompt. Checkout where your visual studio with nmake is installed. IIRC it should be also a bin folder. You need to replace the MinGW part. Above I have added also an entry to python.

                I added the path of MinGW to the path environment. Now it seems to work. But when I type this:

                configure -static -release -no-exceptions
                

                I get an error: Qmake failed

                K 1 Reply Last reply
                0
                • M magguz

                  @koahnig said in Build exe-file of Qt4-Project:

                  @magguz

                  You have to set the path environment variable to include the folder where your compiler is.

                  set PATH=C:\Users\blablabla\AppData\Local\Programs\Python\Python36-32\;c:\MinGW64\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;%path%
                  

                  I needed to add the path of MinGW and created a bat-file for this. When you start the bat in a command prompt it will be only available until you close the prompt. Checkout where your visual studio with nmake is installed. IIRC it should be also a bin folder. You need to replace the MinGW part. Above I have added also an entry to python.

                  I added the path of MinGW to the path environment. Now it seems to work. But when I type this:

                  configure -static -release -no-exceptions
                  

                  I get an error: Qmake failed

                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #8

                  @magguz

                  My compilations of Qt 4 are years back. Therefore my memory has significantly faded away and I do not remember what different other tools I had installed. The only I remember is that the configure stuff had be done and then the make.

                  For my fresh Qt 5 installation before Christmas I had to install versions of "perl" and "phyton" (both accessible through the path environment variable). Certainly I had to install the desired compiler which was MinGW 64 bit in my case. The path to python and MinGW are set through the statement already given in my last post.

                  I had picked the desired version of Qt from the archives. For windows you have to pick a .zip version tar-stuff can be used for linux only. Unzipped it to a folder and started from a command prompt in that folder.

                  Here is the configure command, which worked perfectly for me. However, I was compiling Qt 5.9.3 as you see.

                  configure -prefix c:\Qt64\Qt5.9.3 -confirm-license -debug-and-release -opensource -platform win32-g++ -opengl desktop -nomake examples -nomake tests
                  

                  Those parameters are for Qt 5. You need to check the parameters with "configure --help" for your actual version. Within those 9 major release things might have checked. The configure parameters were also explained on web page Qt 4, but I cannot find it right away.

                  Vote the answer(s) that helped you to solve your issue(s)

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

                    Hi,

                    qmake failed doesn't say much, please provide the build log or at least the error messages that comes before this one.

                    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
                    1
                    • M Offline
                      M Offline
                      magguz
                      wrote on last edited by
                      #10

                      Hi,

                      I tried now nmake of my Visual Studio 2017 installation. Therefore I run this command in the VS command prompt:

                      configure -static -release -no-exceptions
                      

                      This works. It shows at the end: "Qt is now configured for building. Just run nmake."
                      But when I run

                      nmake sub-src
                      

                      after 20 minutes of compiling it shows an error:

                      NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.EXE"": Rückgabe-Code "0x2"
                      Stop.
                      NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\nmake.exe"": Rückgabe-Code "0x2"
                      Stop.
                      NMAKE : fatal error U1077: "cd": Rückgabe-Code "0x2"
                      Stop.

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

                        These are the finales lines that just state the compilation failed. Above these are those that are containing what is currently failing to build.

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

                        M 1 Reply Last reply
                        1
                        • SGaistS SGaist

                          These are the finales lines that just state the compilation failed. Above these are those that are containing what is currently failing to build.

                          M Offline
                          M Offline
                          magguz
                          wrote on last edited by
                          #12

                          @SGaist said in Build exe-file of Qt4-Project:

                          These are the finales lines that just state the compilation failed. Above these are those that are containing what is currently failing to build.

                          There is something like this:

                          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cstdint(46): error C2039: "uintmax_t": Ist kein Element von "`global namespace'"
                          C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\cstdint(46): error C2873: "uintmax_t": Das Symbol kann nicht in einer using-Deklaration verwendet werden

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

                            Ok... I didn't realised that you where using VS2017. The latest version of Visual Studio used to build Qt 4.8 was 2015. You will have to copy the 2015 mkspec and tweak it in order to build it.

                            MinGW might be a quicker choice depending on your needs.

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

                            M 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              Ok... I didn't realised that you where using VS2017. The latest version of Visual Studio used to build Qt 4.8 was 2015. You will have to copy the 2015 mkspec and tweak it in order to build it.

                              MinGW might be a quicker choice depending on your needs.

                              M Offline
                              M Offline
                              magguz
                              wrote on last edited by
                              #14

                              @SGaist said in Build exe-file of Qt4-Project:

                              Ok... I didn't realised that you where using VS2017. The latest version of Visual Studio used to build Qt 4.8 was 2015. You will have to copy the 2015 mkspec and tweak it in order to build it.

                              MinGW might be a quicker choice depending on your needs.

                              I will try to build it with Visual Studio 2015 tomorrow. Thanks for your hint.

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                magguz
                                wrote on last edited by
                                #15

                                I tried now to build it with Visual Studio 2015 but the same errors ocurr.

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

                                  During which part of the build ?

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

                                  M 1 Reply Last reply
                                  0
                                  • SGaistS SGaist

                                    During which part of the build ?

                                    M Offline
                                    M Offline
                                    magguz
                                    wrote on last edited by
                                    #17

                                    @SGaist said in Build exe-file of Qt4-Project:

                                    During which part of the build ?

                                    during the compilation with nmake

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

                                      So configure is successful ?

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

                                      M 1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        So configure is successful ?

                                        M Offline
                                        M Offline
                                        magguz
                                        wrote on last edited by
                                        #19

                                        @SGaist said in Build exe-file of Qt4-Project:

                                        So configure is successful ?

                                        yes

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

                                          By the way, which version of 4.8 is it ?

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

                                          M 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