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. Console window not displaying
Qt 6.11 is out! See what's new in the release blog

Console window not displaying

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 10 Posters 9.6k Views 3 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.
  • hskoglundH Offline
    hskoglundH Offline
    hskoglund
    wrote on last edited by hskoglund
    #2

    Hi, you're talking about running a console program from inside Qt Creator, right?
    This behavior is not a bug, it's a feature in Qt Creator version 6. (Haven't tested Qt Creator version 7 yet but I expect the same as in version 6).

    In earlier versions of Qt Creator, for example 5.0.1, a console window appears as you mention. But in version 6 Qt Creator instead tries to route your printf() calls to the Application Output window in Qt Creator (so that your printf() calls behave more or less like calls to qDebug())
    However this routing to the Application Output window usually never shows up due to the exec() call at the end of main().
    I.e. before version 6 of Qt Creator you could use a simple console program like this:

    #include <QCoreApplication>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        printf("Test");
        return a.exec();
    }
    

    but now you have to remove the exec() call:

    #include <QCoreApplication>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        printf("Hello Qt Creator 6");
    //    return a.exec();
    }
    

    for the printf() call to show up in the Application Output window.

    Edit: Good news! I jusr saw that you can revert to the old behavior (displaying a console window) via an option in the Build & Run, General tab. Look close to the bottom for the "Default for "Run in Terminal" and change it to "Enabled", voila :-)

    J M M ImElijahI 4 Replies Last reply
    3
    • hskoglundH hskoglund

      Hi, you're talking about running a console program from inside Qt Creator, right?
      This behavior is not a bug, it's a feature in Qt Creator version 6. (Haven't tested Qt Creator version 7 yet but I expect the same as in version 6).

      In earlier versions of Qt Creator, for example 5.0.1, a console window appears as you mention. But in version 6 Qt Creator instead tries to route your printf() calls to the Application Output window in Qt Creator (so that your printf() calls behave more or less like calls to qDebug())
      However this routing to the Application Output window usually never shows up due to the exec() call at the end of main().
      I.e. before version 6 of Qt Creator you could use a simple console program like this:

      #include <QCoreApplication>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
          printf("Test");
          return a.exec();
      }
      

      but now you have to remove the exec() call:

      #include <QCoreApplication>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
          printf("Hello Qt Creator 6");
      //    return a.exec();
      }
      

      for the printf() call to show up in the Application Output window.

      Edit: Good news! I jusr saw that you can revert to the old behavior (displaying a console window) via an option in the Build & Run, General tab. Look close to the bottom for the "Default for "Run in Terminal" and change it to "Enabled", voila :-)

      J Offline
      J Offline
      jcga
      wrote on last edited by
      #3

      @hskoglund said in Console window not displaying:

      Edit: Good news! I jusr saw that you can revert to the old behavior (displaying a console window) via an option in the Build & Run, General tab. Look close to the bottom for the "Default for "Run in Terminal" and change it to "Enabled", voila :-)

      Yes! It works, what a pleasure to see this good ol' black window again! Merci beaucoup !
      Jean-Claude

      1 Reply Last reply
      0
      • hskoglundH hskoglund

        Hi, you're talking about running a console program from inside Qt Creator, right?
        This behavior is not a bug, it's a feature in Qt Creator version 6. (Haven't tested Qt Creator version 7 yet but I expect the same as in version 6).

        In earlier versions of Qt Creator, for example 5.0.1, a console window appears as you mention. But in version 6 Qt Creator instead tries to route your printf() calls to the Application Output window in Qt Creator (so that your printf() calls behave more or less like calls to qDebug())
        However this routing to the Application Output window usually never shows up due to the exec() call at the end of main().
        I.e. before version 6 of Qt Creator you could use a simple console program like this:

        #include <QCoreApplication>
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
            printf("Test");
            return a.exec();
        }
        

        but now you have to remove the exec() call:

        #include <QCoreApplication>
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
            printf("Hello Qt Creator 6");
        //    return a.exec();
        }
        

        for the printf() call to show up in the Application Output window.

        Edit: Good news! I jusr saw that you can revert to the old behavior (displaying a console window) via an option in the Build & Run, General tab. Look close to the bottom for the "Default for "Run in Terminal" and change it to "Enabled", voila :-)

        M Offline
        M Offline
        MIKELANGELO
        wrote on last edited by
        #4

        @hskoglund thank you for the answer! It helped me much!

        1 Reply Last reply
        1
        • D Offline
          D Offline
          Don Kemlage
          wrote on last edited by
          #5

          You need to make the "Projects" tab active , then choose "Build & Run". In the "Run Settings" section you will find the checkbox to enable "Run in terminal". This is for Qt Creator version 10.0.0.

          EnableTerminalWindowForConsoleApp.png

          E 1 Reply Last reply
          2
          • D Don Kemlage

            You need to make the "Projects" tab active , then choose "Build & Run". In the "Run Settings" section you will find the checkbox to enable "Run in terminal". This is for Qt Creator version 10.0.0.

            EnableTerminalWindowForConsoleApp.png

            E Offline
            E Offline
            Elliot_foo
            wrote on last edited by
            #6

            @Don-Kemlage This method works, but is there no better way?

            JKSHJ 1 Reply Last reply
            0
            • E Elliot_foo

              @Don-Kemlage This method works, but is there no better way?

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #7

              @Elliot_foo said in Console window not displaying:

              @Don-Kemlage This method works, but is there no better way?

              There are other ways:

              • Use qDebug() instead of printf(), OR
              • Call fflush(stdout); after printf()

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              2
              • hskoglundH hskoglund

                Hi, you're talking about running a console program from inside Qt Creator, right?
                This behavior is not a bug, it's a feature in Qt Creator version 6. (Haven't tested Qt Creator version 7 yet but I expect the same as in version 6).

                In earlier versions of Qt Creator, for example 5.0.1, a console window appears as you mention. But in version 6 Qt Creator instead tries to route your printf() calls to the Application Output window in Qt Creator (so that your printf() calls behave more or less like calls to qDebug())
                However this routing to the Application Output window usually never shows up due to the exec() call at the end of main().
                I.e. before version 6 of Qt Creator you could use a simple console program like this:

                #include <QCoreApplication>
                
                int main(int argc, char *argv[])
                {
                    QCoreApplication a(argc, argv);
                    printf("Test");
                    return a.exec();
                }
                

                but now you have to remove the exec() call:

                #include <QCoreApplication>
                
                int main(int argc, char *argv[])
                {
                    QCoreApplication a(argc, argv);
                    printf("Hello Qt Creator 6");
                //    return a.exec();
                }
                

                for the printf() call to show up in the Application Output window.

                Edit: Good news! I jusr saw that you can revert to the old behavior (displaying a console window) via an option in the Build & Run, General tab. Look close to the bottom for the "Default for "Run in Terminal" and change it to "Enabled", voila :-)

                M Offline
                M Offline
                MrJoeHimself
                wrote on last edited by
                #8

                @hskoglund Oh man I need that, thank you!

                1 Reply Last reply
                0
                • hskoglundH hskoglund

                  Hi, you're talking about running a console program from inside Qt Creator, right?
                  This behavior is not a bug, it's a feature in Qt Creator version 6. (Haven't tested Qt Creator version 7 yet but I expect the same as in version 6).

                  In earlier versions of Qt Creator, for example 5.0.1, a console window appears as you mention. But in version 6 Qt Creator instead tries to route your printf() calls to the Application Output window in Qt Creator (so that your printf() calls behave more or less like calls to qDebug())
                  However this routing to the Application Output window usually never shows up due to the exec() call at the end of main().
                  I.e. before version 6 of Qt Creator you could use a simple console program like this:

                  #include <QCoreApplication>
                  
                  int main(int argc, char *argv[])
                  {
                      QCoreApplication a(argc, argv);
                      printf("Test");
                      return a.exec();
                  }
                  

                  but now you have to remove the exec() call:

                  #include <QCoreApplication>
                  
                  int main(int argc, char *argv[])
                  {
                      QCoreApplication a(argc, argv);
                      printf("Hello Qt Creator 6");
                  //    return a.exec();
                  }
                  

                  for the printf() call to show up in the Application Output window.

                  Edit: Good news! I jusr saw that you can revert to the old behavior (displaying a console window) via an option in the Build & Run, General tab. Look close to the bottom for the "Default for "Run in Terminal" and change it to "Enabled", voila :-)

                  ImElijahI Offline
                  ImElijahI Offline
                  ImElijah
                  wrote on last edited by
                  #9

                  @hskoglund thank you

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    marcolino
                    wrote on last edited by
                    #10

                    Hello,
                    I follow your suggestion but it does not work, the consolle window does not appears. Instead it works in the terminal in bottom of QT creatordaCancellare.JPG daCancellare2.JPG

                    I use Qt creator 14 and QT 6.7.2
                    Please if someone kow the answer.

                    mzimmersM JKSHJ 2 Replies Last reply
                    0
                    • M marcolino

                      Hello,
                      I follow your suggestion but it does not work, the consolle window does not appears. Instead it works in the terminal in bottom of QT creatordaCancellare.JPG daCancellare2.JPG

                      I use Qt creator 14 and QT 6.7.2
                      Please if someone kow the answer.

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #11

                      @marcolino I noticed in your first picture that the "Run in terminal" option is unchecked. Did you check this box, and apply the change?

                      1 Reply Last reply
                      0
                      • M marcolino

                        Hello,
                        I follow your suggestion but it does not work, the consolle window does not appears. Instead it works in the terminal in bottom of QT creatordaCancellare.JPG daCancellare2.JPG

                        I use Qt creator 14 and QT 6.7.2
                        Please if someone kow the answer.

                        JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #12

                        @marcolino said in Console window not displaying:

                        Instead it works in the terminal in bottom of QT

                        That IS the embedded console

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        1 Reply Last reply
                        0

                        • Login

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