Unable to build simple hello-tutorial (Windows 10, command line, Qt5.12.10)
-
@mrinsane said in Unable to build simple hello-tutorial (Windows 10, command line, Qt5.12.10):
My first post, and believe me, I have scanned the internet as a whole trying to find a decent, workable solution to my problem (of which I must say, it seems I am not the only one with this problem.....)
That is very strange, I found this => http://piersshepperson.co.uk/programming/2017/06/18/autobuild-script-qt-projects/
in less than 10 seconds.Which explain very clearly how to build on Windows from command line.
-
Hi all,
Thank you very much for your responses, much appreciated!
@SGaist: Ok, clear enough. make is for Unix systems.. wow, that indeed MAKEs ( :-] )sense (as an extension is never really appearing in any of those statements). So, I stick to the VS and Ming versions.
@mrjj: Thanks, this actually worked just fine. So, at least Qt is installed correctly/qmake is recognized. I have both MSVC(2017) and MinGW (mingw64).
@KroMignon: OK, I was lying a bit, I did read all of the internet....execpt this page you proposed. Nice, another test example to try out.
OK, to be absolutely on the save side, I am doing the following:
) I completely deleted Qt / Qt Creator
) Opened the Qt installer (qt-windows-x86-5.12.10.exe)
) Set the following components:- In Qt/Qt 5.12.10: >-> MSVC 2017 32-bit
- In Qt/Qt 5.12.10: >-> MSVC 2017 64-bit
- In Qt/Qt 5.12.10: >-> MinGW 7.3.0 32-bit
- In Qt/Qt 5.12.10: >-> MinGW 7.3.0 64-bit
(nothing else)
/ - In Qt/Developer and Designer Tools: >-> Qt Creator 4.13.1 CDB Debugger Support
- In Qt/Developer and Designer Tools: >-> MinGW 7.3.0 32-bit
- In Qt/Developer and Designer Tools: >-> MinGW 7.3.0 64-bit
(nothing else)
Worth some 4.91 GB of installing on the C-drive.
Opening Qt, and looking at Tools/Kits, I get some yellow and red flags (probably because now I have multiple instances of some compilers, and some are not properly configured anymore:
Let's revert to the 'new test' as proposed by @KroMignon. I have created a new folder, in which I do the git clone command (resulting in the source files for the "minimal_map" project. I open, as suggested at that website, /minimal_map/minimal_map.pro.
Qt requests me to select a proper kit, I choose "Desktop Qt 5.12.10 MinGW 64-bit" (4th from above in the image). I then right-click the project in the Projects tree window, and click Build. Wow, first time, no errors. Nothing is complaining.In "/minimal_map/../build-minimal_map-debug " the following files are present: .qmake.stash; Makefile; Makefile.Debug; and Makefile.Release. All makes sense.
Next, in "/minimal_map/../build-minimal_map-debug/debug " (created by the build) the following files are present: main.o; qrc_qml.cpp; qrc_qml.o (don't know any of these filse, I assume these should be here anyway); and (FINALLY, never got this before...) the executable minimal_map.exe. So, I run the exe. Nopes...
I must say, this freaks me out. Apparently it is very unstable to build your own project. I know quite some non-Qt-non-GUI-non-widget C++, usually running MinGW compiler, without any issues.
Starting to think I should skip doing Qt-stuff, as it is not cute at all...Where does it go wrong? Or, am I REALLY stupid, and am I missing some major stuff in the wwhole process?
Hope you ppl can help me out.
Thanks in advance!!Best regards,
Paul -
Did you double-click on the executable file ?
-
Did you install the OpenSSL libraries ?
-
@mrinsane your .exe cannot load SSL libs during runtime. You can verify that by putting them in the same folder as your .exe.
If you use OpenSSL runtime provided by Qt please bear in mind that those are built using MSVC and as such require additional Microsoft runtime libs which may already be present in your system but as well might not. -
Then you did not deploy the application hence the error. That's a classic.
-
Hi all,
@SGaist: Thank you for providing the link. Interesting material, that is.
As suggested by @SGaist: running windeployqt.exe does update the dll's which are 'missing'. This results in some 10+ dll-files added to the "working" directory (in which the .exe is situated).
Running windeployqt:
What I get, is that by building the project, some dependencies are omittted, if you like. A couple of questions:
- Would this be in some way fixable, meaning that it will be done automatically through building the project?
- Is this the way forward, for ALL projects which have GUIs/widgets / Qt-coding?
- Is this "updating dll's" the same as applying the OpenSSL libraries, or are these a completely different thing?m(not so familiar with dependencies, yet ;] )
Update: after fixing the dll dependencies as stated above, I do NOT get the error message, however, nothing at all happens.
/Paul
-
Looks like you are implementing a QtQuick application, if so, you should use the -qml option so that your files can be scanned and deployed if needed. That will also deploy their dependencies.
-
Hi,
I stopped for some days, and when trying some <other> projects it,once again, fired the same error (the 000007b).
Where should I do the -qml? In the qmake? Or in the mingw32-make.exe ? Or in the windeployqt?And, what is the reason I have to call it? Why isn't it automatically called, if needed?
Regarding this other project: I tried to use the Qt-environment within Visual Studio 2019, building the simple project (simply projecting a rectangle) resulted in 1 "succeeded", but double-click Tutorial1.exe results in 000007b. Also after windeployqt.
-
@mrinsane said in Unable to build simple hello-tutorial (Windows 10, command line, Qt5.12.10):
Hi,
I stopped for some days, and when trying some <other> projects it,once again, fired the same error (the 000007b).
Where should I do the -qml? In the qmake? Or in the mingw32-make.exe ? Or in the windeployqt?And, what is the reason I have to call it? Why isn't it automatically called, if needed?
Regarding this other project: I tried to use the Qt-environment within Visual Studio 2019, building the simple project (simply projecting a rectangle) resulted in 1 "succeeded", but double-click Tutorial1.exe results in 000007b. Also after windeployqt.
Wow... even my simple "helloQT" test, which was working (only after the windeployqt was performed) is now also resulting in 000007b. (It does quite seem that Qt is buggy /or I should say 'supersensitive', which means it almost is impossible to work with.....It cannot be that some exe suddenly does not want to run, can it?
-
It's an argument of windeployqt.
You can't always automate everything. The tool helps you creating a deployable application but you have to feed it some information.
-
Ok, that's it. Qt is schizophrenic by itself. :-( :-(
I "fixed' the Hello Qt test. Somewhat.
I will explain all I did:- Windows 10, 64-bit.
- hello tutorial, which pops-up a widget, with the text "HelloQt!"
- Qt Creator 4.13.1 (as part of Qt 5.15.1 (MSVC 2019, 32bit)). [actually, the Qt install in C:\ says 5.12.0 ]
- code hello.pro:
###################################################################### # Automatically generated by qmake (3.1) Tue Mar 30 00:57:06 2021 ###################################################################### TEMPLATE = app TARGET = hello INCLUDEPATH += . # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 # Input SOURCES += hello.cpp QT += widgets
- code hello.cpp:
#include <QApplication> #include <QLabel> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("<h2><i>Hello</i> " "<font color=green>Qt!</font></h2>");; label->show(); //QPushButton *button = new QPushButton("Quit"); //QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit())); //button->show(); return app.exec(); }
- I open the project by doubleclick hello.pro -it opens in QtCreator
- I get presented a dialogue for configuring the project: I choose Qt 5.12.10 MinGW 64-bit
- I click BUILD, and the build-folders (debug, release) are created, no errors whatsoever in QtCreator.
- If I click RUN, the following happens:
- In Application Output, the following is stated:
- When I navigate (CMD) to the location of the exe (\build-hello-debug\debug), I doubleclick:
- Performing the windeploy (C:\Qt\Qt5.12.10\5.12.10\mingw73_32\bin\windeployqt.exe -qml .)
- Same error, it does not want to run.
So, as a summary: Qt processes the code, the appropriate folders/files aregenerated. It even is capable of DOING what it should do (i.e., show the window with some text), but the application itself (*.exe) does not want to do it.
I'm going crazy.
-
@mrinsane said in Unable to build simple hello-tutorial (Windows 10, command line, Qt5.12.10):
- I get presented a dialogue for configuring the project: I choose Qt 5.12.10 MinGW 64-bit
... - Performing the windeploy (C:\Qt\Qt5.12.10\5.12.10\mingw73_32\bin\windeployqt.exe -qml .)
You can't mix 32-bit and 64-bit binaries.
Delete the 64-bit .exe and the 32-bit DLLs from that folder. Then, try again using C:\Qt\Qt5.12.10\5.12.10\mingw73_64\bin\windeployqt.exe.
Note: You don't need
-qml
when deploying your Hello app, since you're not using QML here - I get presented a dialogue for configuring the project: I choose Qt 5.12.10 MinGW 64-bit
-