Solved Qt5.5.1 Win32 App Developed by VS2013 Template "Qt Quick2 Application" Deploy Issue
-
Hi @Channa, and welcome to the Qt Dev Net!
I copied all those .dlls (that were currently missing, from System32 and SysWOW64 folders) onto the same folder as where my app executable resides. So far, whenever the application runs, the screen showed no controls in it (white screen!). No other errors and, it is a very simple app (just one page).
Have a look at http://wiki.qt.io/Deploy_an_Application_on_Windows and follow the "Initial deployment (Quick and dirty)" section, for a start. What step are you able to get to?
You don't need to (and you shouldn't) copy anything from the System32 or SysWOW64 folders.
-
Hi @JKSH,
Thank you so much for the quick tip.
Although it did not help much, following are the steps that I performed (as directed in Initial deployment (Quick and dirty) section of your URL link).- Closed VS2013 instance.
- Copy the following into the deployment folder
I. The release version of my executable
ii. All the .dll files from C:\Qt5.5.1\5.5\msvc2013\bin
iii. All the folders from C:\Qt5.5.1\5.5\msvc2013\plugins
iv. (Since I am using QML) All the folders from C:\Qt5.5.1\5.5\msvc2013\qml\ - Rename C:\Qt5.5.1 to C:\QtHIDDEN5.5.1
- Launch executable from deployment folder.
Please Note: When compared to the screenshot-illustrated section of the article in the URL link, VS2013 project structure and Qt libraries folders under msvc2013 folder are quite different. I don't know much to make much of sense a better comparison here, as I am very new to Qt development. However, I followed the directions to the letter...
Is there anything else that I can do to try at this point? Any help would be highly appreciated.
-
Hi @Channa,
- Just to confirm, you tried this on your development PC, right?
- Does your app work if you run it from inside MSVC?
- Rename C:\QtHIDDEN5.5.1 back to C:\Qt5.5.1 and then launch the executable from the deployment folder again. Does it display correctly?
-
- Yes.
- Yes, VS2013 IDE displays the app window correctly.
- Nope.
-
@Channa said:
- Yes, VS2013 IDE displays the app window correctly.
- Nope.
Hmm... that's quite strange to me. Could you try to deploy the Hello World project (where you didn't modify any code)?
If that doesn't work, please post a screenshot of your development folder.
Also, use Process Explorer and carefully look at the list of all DLLs that your app is using. Do this (i) when it's running from VS2013, and (ii) when you double-clicked the icon. Are the 2 lists the same?
-
Hi @JKSH
Thanks again!
So, I did...- Created QtHelloWorld project in VS2013 Pro using "Qt Quick2 Application" project template. Made sure that the Hello World! is showing on the screen when I ran it within VS2013 IDE using Ctrl + F5 (Start without debugging).
- Built the Release (Win32) version of QtHelloWorld.exe and copied to deployment folder (C:\QtHelloWorld).
- Copied all the .dll files from C:\Qt5.5.1\5.5\msvc2013\bin\ onto C:\QtHelloWorld\
- Copied all the folders from C:\Qt5.5.1\5.5\msvc2013\plugins\ onto C:\QtHelloWorld\
- Copied all the folders from C:\Qt5.5.1\5.5\msvc2013\qml\ onto C:\QtHelloWorld\
Launched QtHelloWorld.exe from C:\QtHelloWorld\ folder and, the app launched but, the screen was blank again!!!
Then, I launched Process Explorer and inspected QtHelloWorld.exe instances that were ran within the VS2013 IDE as well as from C:\QtHelloOwrld\ folder. I noticed that the QtHelloWorld.exe instance that was launched by VS2013 IDE loads following 4 additional .dlls than the other instance.
- C:\Windows\SysWOW64\apphelp.dll
- C:\Windows\SysWOW64\propsys.dll
- C:\Windows\SysWOW64\profapi.dll
- C:\Qt5.5.1\5.5\msvc2013\qml\QtQuick.2\qtquick2plugin.dll
I copied these 4 .dlls onto C:\QtHelloWorld\ folder and re-launched the QtHelloWorld.exe app from the C:\QtHelloWorld\ folder. However, these 4 .dlls did not get loaded this time either and, the app screen was still blank as before.
There is our key, I guess. Any idea what is going on? As a newbie... I have no clue!!!
-
@Channa said:
- C:\Windows\SysWOW64\apphelp.dll
- C:\Windows\SysWOW64\propsys.dll
- C:\Windows\SysWOW64\profapi.dll
Do not copy these. Windows system DLLs should be left inside C:\Windows.
- C:\Qt5.5.1\5.5\msvc2013\qml\QtQuick.2\qtquick2plugin.dll
This DLL cannot be placed in the same folder as your .exe file. It should be placed in C:\QtHelloWorld\qml\QtQuick.2\qtquick2plugin.dll. However, It should already be copied when you did 5. Copied all the folders from C:\Qt5.5.1\5.5\msvc2013\qml\ onto C:\QtHelloWorld. Is it there?
One last thing: You might need to copy your custom .qml file(s) too. I haven't used the MSVC IDE before though, so I don't know what code it automatically generates for you. Can you please post your main.cpp code?
-
Hi @JKSH
The C:\QtHelloWorld\qml\QtQuick.2\qtquick2plugin.dll is already present.Following code is what the VS2013 automatically generating..
<CODE>
#include "qtquick2applicationviewer.h"
#include <QtGui/QGuiApplication>int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("main.qml")); viewer.showExpanded(); return app.exec();
}
</CODE>Following is the main.qml contents... This is the only custom .qml file. Where should I copy this into?
On a side note, I would NOT want to deploy my custom .qml files on customer's systems!!!
<CODE>
import QtQuick 2.0Rectangle {
width: 360
height: 360
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
}</CODE> -
Never mind!!!
I copied main.qml onto C:\QtHelloWorld\folder and launched QtHelloWorld.exe and, all worked well!!
I did the same thing with my own app and it does work now...
WOW, I never thought that we need to deploy our custom .qml files with the executable this way... Is there a way to get thee custom .qml files compiled onto the .exe?
Anyways, thanks so much for all your help! Problem solved!!!
-
@Channa said:
I copied main.qml onto C:\QtHelloWorld\folder and launched QtHelloWorld.exe and, all worked well!!
I did the same thing with my own app and it does work now...
Great! :) Please mark your topic as "SOLVED".
WOW, I never thought that we need to deploy our custom .qml files with the executable this way... Is there a way to get thee custom .qml files compiled onto the .exe?
There are two ways to avoid copying the .qml files:
- Use the Qt Resource System to build the .qml files directly into your .exe file. Note: If someone tries to reverse-engineer your .exe file, they will be able to see the QML code in plain text.
- Use the Qt Quick Compiler to compile your .qml files into bytecode. This makes it much harder to reverse-engineer, and also improves start-up performance. Note: This tool requires a commercial license.
Anyways, thanks so much for all your help! Problem solved!!!
You're welcome! Good work on investigating and trying things out yourself; I only provided hints, and you used those hints to solve the problem.