Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt-Widgets-Application print something to console/terminal
Forum Updated to NodeBB v4.3 + New Features

Qt-Widgets-Application print something to console/terminal

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 337 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danny778
    wrote on 27 Aug 2024, 09:05 last edited by
    #1

    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!

    J 1 Reply Last reply 27 Aug 2024, 09:16
    0
    • D Danny778
      27 Aug 2024, 09:05

      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!

      J Offline
      J Offline
      JonB
      wrote on 27 Aug 2024, 09:16 last edited by
      #2

      @Danny778
      Qt widget applications, being a UI, do not have a console/terminal. You don't see stuff sent to std::cout. Why would you want to in a non-console application? For debugging you can still use qDebug() and see output from Qt Creator, otherwise I can't think of a use.

      D 1 Reply Last reply 27 Aug 2024, 09:19
      0
      • J JonB
        27 Aug 2024, 09:16

        @Danny778
        Qt widget applications, being a UI, do not have a console/terminal. You don't see stuff sent to std::cout. Why would you want to in a non-console application? For debugging you can still use qDebug() and see output from Qt Creator, otherwise I can't think of a use.

        D Offline
        D Offline
        Danny778
        wrote on 27 Aug 2024, 09:19 last edited by
        #3

        @JonB
        Trying out Qt for an exercise for my university. Didn't know that, today is my first day trying out Qt and was a little bit confused.
        Thank you very much for your help!

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on 27 Aug 2024, 09:21 last edited by
          #4

          I guess you are under windows? That's the default behavior for windows gui application.
          You'll need to add

          win32: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 Reply Last reply
          1

          1/4

          27 Aug 2024, 09:05

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved