Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to make the qml executable in windows?
Forum Updated to NodeBB v4.3 + New Features

How to make the qml executable in windows?

Scheduled Pinned Locked Moved QML and Qt Quick
19 Posts 3 Posters 11.1k Views 1 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.
  • Q Offline
    Q Offline
    qxoz
    wrote on last edited by
    #2

    I'm not use Visual studio, but Qt quick 2 application should create executable for Desktop.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Muhammad
      wrote on last edited by
      #3

      Yes, Qt quick 2 application does create .exe file if I build it as a release, but the .exe file doesn't work even after putting the required .dll files in the same folder with the .exe file, and this is what panics me :(
      Don't know what to do, any help?

      I don't have endpoint, I just have Checkpoints.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #4

        You mean dosen't start at all or app starts but with empty window?
        In first case what the error message?
        In second case check *.qml files locations in main.cpp and place them in same directory near *.exe.
        Or insert qml files in resource file.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Muhammad
          wrote on last edited by
          #5

          There is no error, I just run the *.exe file but it shows nothing.
          I tried it with Qt4.8 before installing Qt5, and it did open an empty window, but now it shows nothing.
          Would you please tell me exactly how to insert the *.qml file in the resources,My be I'm doing something wrong.
          -I'm not adding any extra *.qml files I just want to run the ready made hello world, from the exe.
          Thanks

          I don't have endpoint, I just have Checkpoints.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Muhammad
            wrote on last edited by
            #6

            Any help???

            I don't have endpoint, I just have Checkpoints.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tolszak
              wrote on last edited by
              #7

              Could you please paste the code of your main.cpp?

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Muhammad
                wrote on last edited by
                #8

                Here is the code

                @#include <QtGui/QGuiApplication>
                #include "qtquick2applicationviewer.h"

                int main(int argc, char *argv[])
                {
                QGuiApplication app(argc, argv);

                QtQuick2ApplicationViewer viewer;
                viewer.setMainQmlFile&#40;QStringLiteral("qml/asdfasdf/main.qml"&#41;&#41;;
                viewer.showExpanded();
                
                return app.exec&#40;&#41;;
                

                }
                @

                this code is without adding a resource file

                I don't have endpoint, I just have Checkpoints.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Muhammad
                  wrote on last edited by
                  #9

                  The previous code is without adding any thing in the resources

                  I don't have endpoint, I just have Checkpoints.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Muhammad
                    wrote on last edited by
                    #10

                    And here is the main.cpp after adding the resource file
                    @#include <QtGui/QGuiApplication>
                    #include "qtquick2applicationviewer.h"

                    int main(int argc, char *argv[])
                    {
                    QGuiApplication app(argc, argv);

                    QtQuick2ApplicationViewer viewer;
                    viewer.setMainQmlFile&#40;QStringLiteral(":qml/asdfasdf/main.qml"&#41;);
                    viewer.showExpanded();
                    
                    return app.exec();
                    

                    }
                    @

                    I don't have endpoint, I just have Checkpoints.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Muhammad
                      wrote on last edited by
                      #11

                      When I add the resources It and run the project in Qt creator, it shows me empty window

                      I don't have endpoint, I just have Checkpoints.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Muhammad
                        wrote on last edited by
                        #12

                        !http://imageshack.us/photo/my-images/853/49026492.jpg/(photo)!

                        here is a photo for the resource file, and for the project hierarchic

                        This is link for the photo if it didn't appear
                        http://imageshack.us/photo/my-images/853/49026492.jpg/

                        I don't have endpoint, I just have Checkpoints.

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          tolszak
                          wrote on last edited by
                          #13

                          Try changing line:
                          @
                          viewer.setMainQmlFile(QStringLiteral(":qml/asdfasdf/main.qml"));
                          @

                          to
                          @
                          viewer.setMainQmlFile(QStringLiteral(QUrl("qrc:///Here/qml/asdfasdf/main.qml")));
                          @

                          And paste log from qtcreator

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Muhammad
                            wrote on last edited by
                            #14

                            It shows lots of errors

                            17:11:52: Running steps for project asdfasdf...
                            17:11:52: Configuration unchanged, skipping qmake step.
                            17:11:52: Starting: "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe"
                            C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
                            cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\asdfasdf\qtquick2applicationviewer" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtQuick" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtQml" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtNetwork" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtGui" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore" -I"release" -I"." -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\FBM\AppData\Local\Temp\main.obj.2632.16.jom
                            Copying application data...
                            1 File(s) copied
                            main.cpp
                            Copying application data...
                            1 File(s) copied
                            ..\asdfasdf\main.cpp(10) : error C2070: ''unknown-type'': illegal sizeof operand
                            ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                            ........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore/qstring.h(193) : warning C4200: nonstandard extension used : zero-sized array in struct/union
                            Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
                            ..\asdfasdf\main.cpp(10) : see reference to class template instantiation 'QStaticStringData<N>' being compiled
                            with
                            [
                            N=-1
                            ]
                            ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                            ..\asdfasdf\main.cpp(10) : error C2070: ''unknown-type'': illegal sizeof operand
                            ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                            ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                            jom: C:\Users\FBM\Desktop\asdfasdf-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\Makefile.Release [release\main.obj] Error 2
                            jom: C:\Users\FBM\Desktop\asdfasdf-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\Makefile [release] Error 2
                            17:11:53: The process "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
                            Error while building/deploying project asdfasdf (kit: Desktop Qt 5.0.0 MSVC2010 32bit (SDK))
                            When executing step 'Make'

                            I don't have endpoint, I just have Checkpoints.

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              tolszak
                              wrote on last edited by
                              #15

                              Ehh sorry,
                              Y must include QUrl header in top of main.cpp
                              @
                              #include <QUrl>
                              @

                              and try again

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                Muhammad
                                wrote on last edited by
                                #16

                                I included it and looks like I got the same errors

                                20:37:14: Running steps for project asdfasdf...
                                20:37:14: Configuration unchanged, skipping qmake step.
                                20:37:14: Starting: "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe"
                                C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe -f Makefile.Release
                                cl -c -nologo -Zm200 -Zc:wchar_t -O2 -MD -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -I"..\asdfasdf\qtquick2applicationviewer" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtQuick" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtQml" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtNetwork" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtGui" -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore" -I"release" -I"." -I"........\Qt\Qt5.0.0\5.0.0\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\FBM\AppData\Local\Temp\main.obj.2568.15.jom
                                main.cpp
                                Copying application data...
                                1 File(s) copied
                                Copying application data...
                                1 File(s) copied
                                ..\asdfasdf\main.cpp(10) : error C2070: ''unknown-type'': illegal sizeof operand
                                ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                                ........\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore/qstring.h(193) : warning C4200: nonstandard extension used : zero-sized array in struct/union
                                Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
                                ..\asdfasdf\main.cpp(10) : see reference to class template instantiation 'QStaticStringData<N>' being compiled
                                with
                                [
                                N=-1
                                ]
                                ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                                ..\asdfasdf\main.cpp(10) : error C2070: ''unknown-type'': illegal sizeof operand
                                ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                                ..\asdfasdf\main.cpp(10) : error C3861: 'LQUrl': identifier not found
                                jom: C:\Users\FBM\Desktop\asdfasdf-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\Makefile.Release [release\main.obj] Error 2
                                jom: C:\Users\FBM\Desktop\asdfasdf-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\Makefile [release] Error 2
                                20:37:17: The process "C:\Qt\Qt5.0.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
                                Error while building/deploying project asdfasdf (kit: Desktop Qt 5.0.0 MSVC2010 32bit (SDK))
                                When executing step 'Make'

                                I don't have endpoint, I just have Checkpoints.

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  tolszak
                                  wrote on last edited by
                                  #17

                                  I think that you didn't recompile project or did not add QUrl include because error:
                                  ..\asdfasdf\main.cpp(10) : error C2070: ‘‘unknown-type’‘: illegal sizeof operand
                                  ..\asdfasdf\main.cpp(10) : error C3861: ‘LQUrl’: identifier not found

                                  Is still the same (the same line). If you added #include <QUrl> then error line would be 11 not 10.

                                  Try to add #include <QUrl> and clean and rebuild projects.

                                  I must say that i didn't use MS compiler for a couple of years and did not remeber complator errors but it's clearly looks like it doesn't have QUrl header.

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    Muhammad
                                    wrote on last edited by
                                    #18

                                    I did include the <QUrl> , but the reason of the error being in the same line (10), is that I had an empty line between the headers and the main, So I just put the <QUrl> on it :)

                                    I don't have endpoint, I just have Checkpoints.

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      Muhammad
                                      wrote on last edited by
                                      #19

                                      HURRAH, It might be a temporary solution, but I figured it out.
                                      I copied all the *.dll files in the this directory C:\Qt\Qt5.0.1\5.0.1\msvc2010\bin and paste it in the same folder with my *.exe file and it worked.
                                      The next step is to remove one file at a time and run the *.exe after every remove till I figure which files exactly the app needs.

                                      @tolszak Thank you very much for your help :)
                                      @qxoz Thank you very much for your help too :)

                                      I don't have endpoint, I just have Checkpoints.

                                      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