0

I was using Qt Creator 2.7.0 and compiling with 5.0.2 MinGW 32bit a simple C++ main.cpp:

#include <iostream>

using namespace std;

int main()
{
    int i;
    for (i=1; i<52; i++)
    {
        cout << i << endl;
    }

    return 0;
}

On project configuration I can check the box "Run in terminal", when I do this a Windows command prompt shows up and I get the expected results of 1 through 51 being printed out one number per line on each run of the program.

However, if I uncheck this and instead run this in the "Application Output" window. I get results that do not appear deterministic. On one run it output only the number 1, on another run it stopped at 48, another run stopped at 38. Each time reporting exited with code 0. Anyways, what's the deal here with this?

Here's the .pro file:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp
user17753
  • 3,083
  • 9
  • 35
  • 73
  • This post could be helpful for you http://stackoverflow.com/questions/13246424/no-output-from-hello-world-qt-sdk-2010-mingw-gcc-4-6-3-windowsxp although you get some output so maybe it does not help. – user2672165 Sep 24 '13 at 16:26
  • No, that flag is already in there. Also, what's weird is running in debug (F5) works just fine; but running with Ctrl+R produces this odd non-deterministic results. – user17753 Sep 24 '13 at 18:01

0 Answers0