How to make the qml executable in windows?
-
wrote on 31 Jan 2013, 17:54 last edited by
Hello guys,Would you please tell me How can I make a working .exe program with Qt Quick.
I'm using Qt5 with Visual studio 2010, So which project should I choose (Qt quick 2 application or Qt quick2 UI or what?) -
wrote on 1 Feb 2013, 04:39 last edited by
I'm not use Visual studio, but Qt quick 2 application should create executable for Desktop.
-
wrote on 1 Feb 2013, 07:01 last edited by
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? -
wrote on 1 Feb 2013, 07:13 last edited by
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. -
wrote on 1 Feb 2013, 08:01 last edited by
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 -
wrote on 1 Feb 2013, 13:30 last edited by
Any help???
-
wrote on 1 Feb 2013, 13:43 last edited by
Could you please paste the code of your main.cpp?
-
wrote on 1 Feb 2013, 13:50 last edited by
Here is the code
@#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("qml/asdfasdf/main.qml")); viewer.showExpanded(); return app.exec();
}
@this code is without adding a resource file
-
wrote on 1 Feb 2013, 13:51 last edited by
The previous code is without adding any thing in the resources
-
wrote on 1 Feb 2013, 13:56 last edited by
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(QStringLiteral(":qml/asdfasdf/main.qml")); viewer.showExpanded(); return app.exec();
}
@ -
wrote on 1 Feb 2013, 13:57 last edited by
When I add the resources It and run the project in Qt creator, it shows me empty window
-
wrote on 1 Feb 2013, 14:05 last edited by
!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/ -
wrote on 1 Feb 2013, 14:33 last edited by
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
-
wrote on 1 Feb 2013, 15:13 last edited by
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' -
wrote on 1 Feb 2013, 18:16 last edited by
Ehh sorry,
Y must include QUrl header in top of main.cpp
@
#include <QUrl>
@and try again
-
wrote on 1 Feb 2013, 18:38 last edited by
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' -
wrote on 1 Feb 2013, 18:44 last edited by
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 foundIs 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.
-
wrote on 2 Feb 2013, 11:42 last edited by
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 :)
-
wrote on 3 Feb 2013, 08:23 last edited by
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 :)
3/19