Qt-Widgets-Application print something to console/terminal
-
wrote on 27 Aug 2024, 09:05 last edited by
Hello Community,
i am new here and need Qt for my studies.
I have a short and simple question:Created a Qt-Console application, there i can print something to the terminal with std::cout after enableing it in the settings.
It works without any problem.For a Qt-Widget-Application it does not work.
Can someone help me as a Newbie?
Thanks in advance! -
Hello Community,
i am new here and need Qt for my studies.
I have a short and simple question:Created a Qt-Console application, there i can print something to the terminal with std::cout after enableing it in the settings.
It works without any problem.For a Qt-Widget-Application it does not work.
Can someone help me as a Newbie?
Thanks in advance!wrote on 27 Aug 2024, 09:16 last edited by@Danny778
Qt widget applications, being a UI, do not have a console/terminal. You don't see stuff sent tostd::cout
. Why would you want to in a non-console application? For debugging you can still useqDebug()
and see output from Qt Creator, otherwise I can't think of a use. -
@Danny778
Qt widget applications, being a UI, do not have a console/terminal. You don't see stuff sent tostd::cout
. Why would you want to in a non-console application? For debugging you can still useqDebug()
and see output from Qt Creator, otherwise I can't think of a use. -
wrote on 27 Aug 2024, 09:21 last edited by
I guess you are under windows? That's the default behavior for windows gui application.
You'll need to addwin32:CONFIG += console
to the pro file if you are using qmake.
But then there will be another problem, if you start the application from console/terminal, it is ok, but when you double click the exe, there will also be a console window which probably you dont want.
So why you need std::cout in a gui application in the first place?
1/4