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. [SOLVED] Terminal Won't Stay Open in Console Project
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Terminal Won't Stay Open in Console Project

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 5.6k Views 2 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.
  • B Offline
    B Offline
    Blakeasd
    wrote on 6 Apr 2013, 21:44 last edited by
    #1

    Hello!

    I recently began developing in Qt, but I am having an issue with console projects. When I run my program (Console Program), terminal opens and then immediately closes so I cannot see the output.

    Here is the code that I am using:

    @
    #include <QtCore/QCoreApplication>
    #include <QDebug>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    qDebug() << "In the stream";
    
    
    return a.exec&#40;&#41;;
    

    }
    @

    I looked in my project's .pro file and it seems to be setup correctly (it is configured to use the console with CONFIG += console). I am not sure why the terminal window won't stay open. I have tried adding @system("PAUSE")@

    This does not work however. I am using Ubuntu and the default Qt Creator settings. Could someone tell me how to keep the console/terminal open so I can see the @qdebug@ output.

    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Apr 2013, 21:58 last edited by
      #2

      Hi and welcome to DevNet,

      How do you start your program ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Blakeasd
        wrote on 6 Apr 2013, 22:27 last edited by
        #3

        Hello.

        To start the program I press the green play button (Run), but I have tried pressed play button with a bug on it (Debug). I also would like to note that when I press the stop button next to Application Output, nothing happens ; if that makes a difference.

        Thanks for replying.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Blakeasd
          wrote on 8 Apr 2013, 02:17 last edited by
          #4

          Update:

          I can ./ the executable the QtCreator makes, but when I run the program with QtCreator the terminal window immediately closes.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sam
            wrote on 8 Apr 2013, 05:49 last edited by
            #5

            Hi,

            If you disable the terminal then you can get the qDebug() output in Qt Creator "Application output pane", In order to do that Goto Projects -> Run Settings -> Uncheck Run in terminal checkbox.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Blakeasd
              wrote on 8 Apr 2013, 15:27 last edited by
              #6

              Disabling terminal worked, thanks!

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 8 Apr 2013, 15:50 last edited by
                #7

                Nice that the solution was found !

                Don't forget to update the thread's title so other forum users may know that a solution has been found :)

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  serkan_tr
                  wrote on 4 May 2024, 13:58 last edited by
                  #8

                  Hi,
                  @Blakeasd, is your operating system Linux? The QT Creator application will run if run as superuser.

                  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