Qt Creator can not open terminal
-
wrote on 8 Aug 2023, 20:44 last edited by
My Qt Creator can not open the terminal when I click the Run button. The application output shows: Starting XXXXXXX
When I use the Run in terminal configuration, it can run in the terminal successfully.How to fix this problem?
-
My Qt Creator can not open the terminal when I click the Run button. The application output shows: Starting XXXXXXX
When I use the Run in terminal configuration, it can run in the terminal successfully.How to fix this problem?
wrote on 8 Aug 2023, 21:53 last edited by JonB 8 Aug 2023, 21:53@thinkingfl
What terminal are you expecting from where when you simply click the Run button? There isn't any, unless your application creates one or you run from a terminal in the first place.When you pick Run in terminal Qt Creator creates a terminal for you and runs your application in it.
-
@thinkingfl
What terminal are you expecting from where when you simply click the Run button? There isn't any, unless your application creates one or you run from a terminal in the first place.When you pick Run in terminal Qt Creator creates a terminal for you and runs your application in it.
wrote on 8 Aug 2023, 22:11 last edited by@JonB My application (A console project) will create one terminal for sure. I can run it on VS code with the CMakeList and it can build, run and create the terminal output. But on QtCreate it can not open any terminal.
-
@JonB My application (A console project) will create one terminal for sure. I can run it on VS code with the CMakeList and it can build, run and create the terminal output. But on QtCreate it can not open any terminal.
@thinkingfl
Please share the following information:- OS and Qt Creator Version
- Is “run in terminal” selected?
- The application itself brings up a terminal. What does that mean? Please show the relevant code.
Please also check this link and share your local configuration.
-
@thinkingfl
Please share the following information:- OS and Qt Creator Version
- Is “run in terminal” selected?
- The application itself brings up a terminal. What does that mean? Please show the relevant code.
Please also check this link and share your local configuration.
wrote on 9 Aug 2023, 18:32 last edited by@Axel-Spoerl
Qt Creator: 11.0.1 Community
Qt: 5.9.9
OS: Windows 64bit
Run in terminal is not selected.
Its a console application, theoretically it will open a terminal and wait for me to input something than stop the porject. (I just try a Hello worldQT pro file
QT = coreCONFIG += c++17 cmdline
You can make your code fail to compile if it uses deprecated APIs.
In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES +=
main.cppDefault rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += targetMain cpp file
#include <QCoreApplication>
#include <iostream>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::cout<<"Hello world!"<<std::endl;
std::cout<<"Press Enter to exis"<<std::endl;
std::cin.get();
return 0;
}Envrioment variables are corrected configured. If I selected run in terminal, the program run without any problem. But When I dis-selected it, the application output
11:31:57: Starting C:\Users\zmh\Documents\build-test-Desktop_Qt_5_9_9_MinGW_32bit-Release\release\test.exe...
Hello world!
Press Enter to exis
11:31:57: C:\Users\zmh\Documents\build-test-Desktop_Qt_5_9_9_MinGW_32bit-Release\release\test.exe exited with code 0And nothing show
-
@Axel-Spoerl
Qt Creator: 11.0.1 Community
Qt: 5.9.9
OS: Windows 64bit
Run in terminal is not selected.
Its a console application, theoretically it will open a terminal and wait for me to input something than stop the porject. (I just try a Hello worldQT pro file
QT = coreCONFIG += c++17 cmdline
You can make your code fail to compile if it uses deprecated APIs.
In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES +=
main.cppDefault rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += targetMain cpp file
#include <QCoreApplication>
#include <iostream>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::cout<<"Hello world!"<<std::endl;
std::cout<<"Press Enter to exis"<<std::endl;
std::cin.get();
return 0;
}Envrioment variables are corrected configured. If I selected run in terminal, the program run without any problem. But When I dis-selected it, the application output
11:31:57: Starting C:\Users\zmh\Documents\build-test-Desktop_Qt_5_9_9_MinGW_32bit-Release\release\test.exe...
Hello world!
Press Enter to exis
11:31:57: C:\Users\zmh\Documents\build-test-Desktop_Qt_5_9_9_MinGW_32bit-Release\release\test.exe exited with code 0And nothing show
wrote on 9 Aug 2023, 19:03 last edited by@thinkingfl
So your code itself does not create any console. Maybe I'm mistaken, but aren't you supposed to tick Run in terminal? Else what is the point of that? Without itstd::cin
won't be open hence it runs to completion. -
C Christian Ehrlicher moved this topic from General and Desktop on 10 Aug 2023, 03:33
1/6