PDA

View Full Version : How to make the quick application executable in windows?



Baso
1st February 2013, 08:36
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,in windows 7(64bit) So which project should I choose (Qt quick 2 application or Qt quick2 UI or what?) and what are the steps should I follow.
-I only want to run the hello world example from the exe.
Thanks

wysota
1st February 2013, 11:44
Qt Quick 2 Application. The wizard will set up all necessary code for you.

Baso
1st February 2013, 13:37
Yes I tried Qt quick 2 application, and I configured the project build setting to release, and I put the *.dll files that the *.exe file asked for in the same folder with the *.exe file, but when I run the *.exe file It doesn't show any thing not even error or any thing :(
Help please

wysota
1st February 2013, 15:12
Did you put the qml files there as well? Can your program find them?

Baso
1st February 2013, 15:30
If you mean putting the main.qml file of the project in the same folder with *.exe file, I did it and it didn't do any different

wysota
1st February 2013, 15:50
I don't know where it should be put. It depends on your application. See if your app starts at all and see if it can find the files it needs. Did you remember to deploy the QtQtuick2 plugin as well? And possibly other plugins your code depends on?

Baso
1st February 2013, 16:05
LOOk, I will tell you what exactly I do
I choose Qt quick 2 application, then give it a name and directory to save,then I go to projects from the left->build setting-edit build configuration and I choose release, then I just run the application from The Qt creator, it runs very well it shows my the hello world window and then I click it and it is closed.
I go to where I saved the project, I find two folders one for the project and the other for the build, I open the one for the build and inside it I open the folder release, hence I find the *.exe file, If I run it, it asks for some dlls, I go to Qt directory in C portion I make a search for the dlls or simply open the bin folder and get the required dlls, I copy the dlls and paste them in the same release folder where the *.exe file lies,then I run the *.exe file and it doesn't show anything no error no file required nothing at all.
Then I got the *qml file form the build foldre -> qml folder and copy it in the same release folder with the *.exe, and run and also nothing happen.

I'm sorry for all of that writhing, but I want to show you exactly what I do, cause I really stuck here, and can't do anything from 2 days :(
Thank you

wysota
1st February 2013, 16:25
Then I got the *qml file form the build foldre -> qml folder and copy it in the same release folder with the *.exe,
That's probably wrong. Your application probably expects the file to be in the "qml" folder if it was initially there.


and run and also nothing happen.
There is a difference between "nothing happens" and "I can't see my QML UI". If "nothing happens" then the app doesn't start which is probably caused by missing dlls. If "I can't see my QML UI" then the process runs (the mandatory DLLs are present) but can't display your UI (missing QML file, missing plugins). You need to teach your app to report its state if you're unable or unwilling to use external tools to verify what is wrong.

For QtQuick apps to work, you need at least the following:
1. Qt dlls (QtCore, QtGui, QtQuick are the bare minimum)
2. their dependencies and compiler runtime
3. your application resources (qml files, images, etc.)
4. plugins for QML that your app relies on (probably at least "qml/QtQuick.2/*", possibly others)
5. Qt dlls those plugins rely on and Qt plugins your resources rely on (e.g. imageformats plugins)
6. your application executable

If unsure, perform dynamic (runtime) inspection of your program using the dependency walker. It will tell you which libraries are used by your app. Then you have to make sure all of them are inplace when you deploy your app.

Baso
1st February 2013, 17:18
I downloaded dependence walker 2.2 and I opened the *.exe file of my project with it, it shows me that the file(IEShims.dll) was missing, but I found it in Internet explorer folder and pasted with my *.exe file, then I ran the dependence walker again and here is a photo for what I got.
8670

-The program still doesn't work!!

Here is link for the photo (better quality )
http://imageshack.us/photo/my-images/37/76012486.png/

ChrisW67
1st February 2013, 21:52
Remove IEShims, it's always 'missing' and this is not the cause of your initial problem.

Open a command prompt, change directory to the deployed program exe folder (or the shadow build folder not the source folder), run "dir /s" and post the resulting text here in
tags

Baso
2nd February 2013, 11:50
Here is resulting text


C:\Users\FBM\Desktop\center-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\re
lease>dir /s
Volume in drive C has no label.
Volume Serial Number is C441-5CF3

Directory of C:\Users\FBM\Desktop\center-build-Desktop_Qt_5_0_0_MSVC2010_32bit_
SDK-Release\release

02/01/2013 05:27 PM <DIR> .
02/01/2013 05:27 PM <DIR> ..
02/01/2013 05:27 PM 15,360 center.exe
02/01/2013 05:27 PM 638 center.exe.embed.manifest
01/30/2013 12:42 PM 2,106,216 D3DCompiler_43.dll
01/30/2013 12:44 PM 17,956,864 icudt49.dll
01/30/2013 12:44 PM 1,330,688 icuin49.dll
01/30/2013 12:44 PM 1,053,184 icuuc49.dll
01/30/2013 12:43 PM 679,936 libGLESv2.dll
02/01/2013 05:27 PM 13,436 main.obj
02/01/2013 05:23 PM 270 main.qml
02/01/2013 05:24 PM 2,999 moc_qtquick2applicationviewer.cpp
02/01/2013 05:24 PM 13,701 moc_qtquick2applicationviewer.obj
01/30/2013 12:44 PM 3,674,624 Qt5Core.dll
01/30/2013 12:44 PM 2,832,384 Qt5Gui.dll
01/30/2013 12:44 PM 820,736 Qt5Network.dll
01/30/2013 12:44 PM 1,367,552 Qt5Qml.dll
01/30/2013 12:44 PM 1,970,688 Qt5Quick.dll
01/30/2013 12:44 PM 2,486,272 Qt5V8.dll
01/30/2013 12:44 PM 4,252,672 Qt5Widgets.dll
02/01/2013 05:24 PM 26,887 qtquick2applicationviewer.obj
19 File(s) 40,605,107 bytes

Total Files Listed:
19 File(s) 40,605,107 bytes
2 Dir(s) 29,908,721,664 bytes free

C:\Users\FBM\Desktop\center-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Release\re
lease>

wysota
2nd February 2013, 12:13
What you have does not include points #2, #4 and #5 in my list. You do have a bunch of unneeded files though, like all the obj files and possibly Qt5Widgets library.

Baso
2nd February 2013, 14:00
So How can I include your #2, #4 and #5 points, Where to get these files mentions in these points?

I'm sorry, but this is the Newbie section :)

wysota
2nd February 2013, 15:34
I really suggest you do a dynamic profile of your app using Dependency Walker, it will show you which files get loaded into your app. Also I suggest to provide some error reporting in your application code, e.g. when QML engine throws an exception, output it to the console.

I cannot tell what exactly your app depends on because I can't see your app's code. I can only guess it depends on the QtQuick plugin (qml/QtQuick.2/*) and possibly on some imageformat plugins if your application uses resources requiring those. Furthermore I think your QML file is in a wrong place. If you used the defaults in the new project wizard, then qml files should have landed in qml/<yourprojectname>/* but you copied them to a totally different path. I understand this is a newbie section but it doesn't mean you shouldn't at least take a look at the code generated for you. The main() function clearly states where it loads the QML file from.

Baso
2nd February 2013, 17:08
Look, It's not a problem with my project, so you can't tell me exactly what my app depends on cause you can't see the code, It is simply I made A Qt quick 2 application, and didn't write any single line,there are those who already written by default for a simple hello world.
So my question is how to run this simple hello world example directly from exe file rather than from Qt creator?

Thanks

wysota
2nd February 2013, 18:24
It is simply I made A Qt quick 2 application, and didn't write any single line,there are those who already written by default for a simple hello world.
So my question is how to run this simple hello world example directly from exe file rather than from Qt creator?

Ok. I'm not on Windows right now so I might be making some errors in commands but hopefully you can fix them yourself.

md C:\Untitled
md C:\Untitled\qml
md C:\Untitled\qml\Untitled
copy <MyProjectBuildDir>\Release\Untitled.exe C:\Untitled
copy <MyProjectDir>\qml\Untitled\main.qml C:\Untitled\qml\Untitled
copy <MyQtDir>\bin\Qt5Core.dll C:\Untitled\
copy <MyQtDir>\bin\Qt5Quick.dll C:\Untitled\
copy <MyQtDir>\bin\Qt5Gui.dll C:\Untitled\
copy <MyQtDir>\bin\Qt5Qml.dll C:\Untitled\
copy <MyQtDir>\bin\Qt5Network.dll C:\Untitled\
copy<MyQtDir>\bin\Qt5Gui.dll C:\Untitled\
copy <MyQtDir>\bin\Qt5V8.dll C:\Untitled\
copy <MyQtDir>\bin\icu*.dll C:\Untitled\
md C:\Untitled\qml\QtQuick.2
copy <MyQtDir>\qml\QtQuick.2\* C:\Untitled\qml\QtQuick.2
copy C:\Windows\system32\msvc*10*.dll C:\Untitled


This should be enough for an empty project. However if you add even a single line anywhere, the set of dependencies might be completely different and without knowing how to find them yourself, you'll be as stuck as you are now.
If it doesn't work, copy EVERYTHING from <MyQtDir>\bin and <MyQtDir>\plugins into C:\Untitled

Baso
2nd February 2013, 19:04
I did exactly what you told, and the exe asked me also for (libGLESv2.dll) and I got it, past it with the other dlls, Guess what!!! ,NOTHING , nothing happened at all, no errors no empty window,s complete silent like Desert :)
I'm desperate :( :(

wysota
2nd February 2013, 22:13
Did you teach your app to report its errors like I asked you?

Baso
3rd February 2013, 08:35
How can I do that?, I didn't find anything in Google related to this.

wysota
3rd February 2013, 10:41
At least put some qDebug() or cout statements in your application's code (remember to add CONFIG+=console to the project file), check if the file you are trying to feed to the application viewer exists, etc. See if your program runs at all and if it outputs any messages to the console.

Baso
3rd February 2013, 18:07
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.

@wysota Thank you very very very very very and very much for being patient with me :)