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. Application Output not displaying cout statements
Forum Updated to NodeBB v4.3 + New Features

Application Output not displaying cout statements

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 3.4k Views
  • 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.
  • R Offline
    R Offline
    regnar86
    wrote on 29 Jun 2016, 05:04 last edited by
    #1

    I'm about as new to Qt as you can get and I have a question in regards to displaying simple output. I normally use Xcode on my macbook for c++ development but since I'm about to start using Qt at work I thought it would be best to familiarize myself to Qt.

    Therefore, my question is how do I setup my Application Output window in Qt to display output for helping me debug my c++ source code. For example when I click build and then click run it displays my output in the "terminal" window. This is fine but its messy and I have to close out of my terminal session every time I run my program. Any help is appreciated.

    I'm sure we all know what a helloworld.cpp file looks like but for completeness here is my code below.

    #include <iostream>
    using namespace std;
    int main()
    {
    cout << "Hello World\n";
    return 0;
    }
    
    D 1 Reply Last reply 29 Jun 2016, 07:08
    0
    • R Offline
      R Offline
      regnar86
      wrote on 29 Jun 2016, 05:30 last edited by regnar86
      #2

      So it appears when I'm in "Debug" mode I can see the output just fine in the "Application Output". However, when i'm in "Run" mode it doesn't output my cout statement in the "Application Output" but will in "Terminal". Which I guess is ok but would rather have more control over this feature.

      If i'm forced to use Terminal I would much rather use iTerm 2. Does someone have some advice here on how to control these features. I see I can add a path to the executable for iTerm2 in Preferences>Environment which I did as shown here.

      link text

      However, when I run my program it will display iterm 2 for like 1 second along with a weird error and vanishes.

      link text

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 29 Jun 2016, 06:13 last edited by
        #3

        If you want to have some debug output then use qDebug() << "message";

        #include <QDebug>
        int main()
        {
        qDebug() << "Hello World";
        return 0;
        }
        

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • R regnar86
          29 Jun 2016, 05:04

          I'm about as new to Qt as you can get and I have a question in regards to displaying simple output. I normally use Xcode on my macbook for c++ development but since I'm about to start using Qt at work I thought it would be best to familiarize myself to Qt.

          Therefore, my question is how do I setup my Application Output window in Qt to display output for helping me debug my c++ source code. For example when I click build and then click run it displays my output in the "terminal" window. This is fine but its messy and I have to close out of my terminal session every time I run my program. Any help is appreciated.

          I'm sure we all know what a helloworld.cpp file looks like but for completeness here is my code below.

          #include <iostream>
          using namespace std;
          int main()
          {
          cout << "Hello World\n";
          return 0;
          }
          
          D Offline
          D Offline
          Devopia53
          wrote on 29 Jun 2016, 07:08 last edited by
          #4

          @regnar86

          Hi,

          Something like this:

          cout << "Hello World" << endl;
          

          std::endl flushes the output buffer but newline('\n').

          1 Reply Last reply
          0

          1/4

          29 Jun 2016, 05:04

          • 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