Qt Creator launch: app not closing and/or "Press <RETURN> to close this window..." missing
-
Hi, everyone!
I've updated Qt Creator to 4.5.0. I'm on Windows, using Qt 5.7.1 MSVC2013.
When running the basic Qt console application, as-is from the template (just create QCoreApplication and exec()), usually the terminal opens, nothing actually happens (main is almost empty, so...), then the line "Press <RETURN> to close this window..." appears nad the window stays there waiting for <RETURN>.
What happens now is that the terminal opens, the "Press <RETURN> to close this window..." line doesn't appear and I have to force-close the app.
It looks like the app "message loop" is still running, so the app won't terminate.Other related behavior, with a more structured app, when I exit for some reason (e.g. I print the command line help then exit) the terminal closes without promting the "Press <RETURN> to close this window..." line, so I can't actually see what happened.
Here, I forcefully close the app (e.g. via a quit()), so I don't get stuck like in the previous example; but I'm (really!) missing the "Press <RETURN> to close this window..." line.What's happening? Did I lost some launch configuration?
Thanks!
MIX -
@massimo.cristofolini said in Qt Creator launch: app not closing and/or "Press <RETURN> to close this window..." missing:
I'm (really!) missing the "Press <RETURN> to close this window..." line.
Look at your .pro file. Does it have the line
CONFIG += console
? -
@JKSH said in Qt Creator launch: app not closing and/or "Press <RETURN> to close this window..." missing:
Look at your .pro file. Does it have the line
CONFIG += console
?Yep.
Here is the .pro file
QT -= gui CONFIG += c++11 console CONFIG -= app_bundle # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked 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 SOURCES += main.cpp
main.cpp source code
#include <QCoreApplication> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); if(argc != 2) { printf("Usage:\n"); printf(" %s <your_name>\n", argv[0]); return 1; } printf("Hello %s!\n", argv[1]); return a.exec(); }
If I provide a command line argument, I get the "Hello ....!" output, exec() is called and the terminal get stuck.
NOTE: the software won't exit both when run via Qt Creator AND standalone via terminal. No good... Looks more like a Qt related problem than a Qt Creator one.If I don't provide an input argument, the software exits before calling exec(). Running from Qt Creator I don't get the "Press <RETURN> to close this window..." and the terminal closes automatically, without letting me see the "Usage" message (too fast).
(Obviously, I don't get the "Press <RETURN> to close this window..." when running from terminal; but that's not an expected behaviour.) -
@massimo.cristofolini said in Qt Creator launch: app not closing and/or "Press <RETURN> to close this window..." missing:
NOTE: the software won't exit both when run via Qt Creator AND standalone via terminal. No good... Looks more like a Qt related problem than a Qt Creator one.
a.exec() blocks until QCoreApplication::quit() is called, so I'm not surprised that it gets stuck.
If I don't provide an input argument, the software exits before calling exec(). Running from Qt Creator I don't get the "Press <RETURN> to close this window..." and the terminal closes automatically, without letting me see the "Usage" message (too fast).
(Obviously, I don't get the "Press <RETURN> to close this window..." when running from terminal; but that's not an expected behaviour.)I'm not sure what's happening here, sorry.
I've updated to Qt Creator 4.5.0 too, but I still get "Press <RETURN> to close this window..." for console applications that I run from Qt Creator. I used Qt 5.9.0 (MinGW 5.3.0) and Qt 5.10.0 (MSVC 2015).
Does this happen on a different computer for you?
-
@JKSH said in Qt Creator launch: app not closing and/or "Press <RETURN> to close this window..." missing:
a.exec() blocks until QCoreApplication::quit() is called, so I'm not surprised that it gets stuck.
I'm pretty sure that an empty Qt Console template program had always exited without needing to call quit(). Can you kindly test this?
@JKSH said in Qt Creator launch: app not closing and/or "Press <RETURN> to close this window..." missing:
I'm not sure what's happening here, sorry.
I've updated to Qt Creator 4.5.0 too, but I still get "Press <RETURN> to close this window..." for console applications that I run from Qt Creator. I used Qt 5.9.0 (MinGW 5.3.0) and Qt 5.10.0 (MSVC 2015).
Does this happen on a different computer for you?
On a non-updated system everything is fine. I'll update it and see qhat happens.
I'll also test the Qt Console template "auto-quit" on another system. -
Tested the previously attached project.
Qt Creator 4.2.2 on Windows, Qt 5.7.0 MSVC2015 32 bit:
- no command argument passed (no exec() called), launched from Qt Creator: program exits with "Press <RETURN> to close this window..."
- command argument passed (exec() called), launched from Qt Creator: sw locks
- command argument passed (exec() called), launched from terminal: sw locks
Qt Creator 4.2.1 on Linux, Qt 5.9.1 GCC 64 bit:
- no command argument passed (no exec() called), launched from Qt Creator: program exits with "Press <RETURN> to close this window..."
- command argument passed (exec() called), launched from Qt Creator: sw locks
- command argument passed (exec() called), launched from terminal: sw locks
Looks like you're right about the fact that one need to call quit(). I'm still quite sure about a different behavior for older Qt versions. Whatever...
Regarding the "Press <RETURN> to close this window...", with these older Qt Creator version I got the line. I'll try updating Qt Creator on a PC and see what happens.
-
I've just updated the previously mentioned Windows system with Qt Creator 4.5.0, still Qt 5.7.0 MSVC2015 32 bit (NOTE: same behavior with Qt 5.7.0 MSVC2015 64 bit).
I've lost the "Press <RETURN> to close this window..." at the end of debug.BUT! I've just noticed that if I Run from Qt Creator instead of Start Debugging, I get the "Press <RETURN> to close this window..." line.
Looks like something related to the debugger.
Interesting thing, after updating Qt Creator I couldn't run the debugger from the IDE, and an error message informed me to reinstall "CDB Debugger Support". After reinstalling (actually, just installing; the component wasn't checked) I can run the debugger, but no "Press <RETURN> to close this window..." line.
A solution -could- be to reinstall Qt from fresh. But that's quite annoying... Also, I'm not sure it will actually fix the problem.Any idea?
-
Back to the topic after the winter break.
I've reinstalled a fresh Qt develop environent on Windows. Awfully, the behavior is still the same. With MSVC compiler (and debugger), no "Press <RETURN> to close this window..." line.
I've noticed that with MinGW I get the "Press <RETURN> to close this window..." line.Given the fact that MinGW is behaving as expected, the fact that the previous test on Linux worked was due to the compiler/debugger more than the Qt version (MinGW is a "Windowized g++")
I suppose that the "CDB Debugger Support" componet installed with the new versions of Qt is screwing some things, and the "Press <RETURN> to close this window..." line won't be displayed no more.Is there anyone that can confirm this behavior?
And anyone else that knows how to fix it? :) -
Hi
Not sure if we think about the same command prompt, but ill just mentioned it anywayTry flipflop it.
-
Yep, I'm talking about that command promt.
The "Run in terminal" checkbox is checked. No better result by unchecking/rechecking/whatever.
From your screenshot, it looks like you are using the last version of Qt libraries (Qt 5.10.0), but an old version of Qt Creator, am I right? As said in my first messages, with older version of Qt Creator (and Qt libs) everything behaved as expected.
If someone can kindly test the last release of Qt+Qt Creator with MSVC compiler/debugger and report their results I'll be very thankful! -
@massimo.cristofolini
Hi
its the Creator that comes with
Qt5.10. Im just using the classic theme.
Ill check exact version when possible. -
Fooled by the picture.
Uhm... so it actually looks like I'm the only unlucky guy that's experiencing this behavior.
Another test I can make is to install the last version of Qt on a clean Windows system. Will take a while... -
Hi
If it works with mingw compiler, then it sounds like something with VS compiler ? -
Hi
Im on Creator 5.10 with vs 2015
Maybe delete .user file and set compiler again ?
Or test with default empty project and set Run in terminal. -
As said in the first post, this happens with the default and almost-default console project.
Tried to delete .user file of an existing project: no luck.
Tried creating a new project again: still no luck. -
Ok. i really dont know how it can "fall off"
I have not heard about this before.it DOES run the qcreator_process_stub.exe ?
(as seen in my image - caption) -
@mrjj Now THAT was the right question!
Running a MinGW project opens the executable in qcreator_process_stub.exe.
Running from a MSVC runs the actual executable (the window title is the executable full path).
The Run Settings for both configurations (MinGW and MSVC (x86 and x64)) looks identical to me; both have "Run in terminal" checked, ... Maybe I have to look in the Run Environment section, since both are set to "use Build Environment", but maybe the environment variables differ for the two configrurations.
Any other hint about where to look at? -
Hi. i didnt find anything else to check with this.
I find it odd if u delete .user file and select compiler how
"run in terminal" can do differently. very odd. -
@mrjj said:
Hi. i didnt find anything else to check with this.
I find it odd if u delete .user file and select compiler how
"run in terminal" can do differently. very odd.Very odd could mean it's a bug. I didn't find something like this problem in the bug database yet.
@massimo-cristofolini: So you could report this issue at bugreports.qt.io