Results 1 to 4 of 4

Thread: Terminal output works but not within QT - Why ?

  1. #1
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Terminal output works but not within QT - Why ?

    I've started using QT4.8.3 and have a very simple question :

    When I execute my compiled programm in a linux terminal window the output using the cout command works fine and the program does what it should do. But within QT when I click on Run there are no errors, a terminal window opens but there is no output. Why is there no output in QT but when executing the same program in a terminal window manually it shows the correct output ?

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Terminal output works but not within QT - Why ?

    can u post a sample code? Did you create console app?

  3. #3
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Terminal output works but not within QT - Why ?

    I selected QT console application for this test project and actually the problem already occurs with a basic hello world code like this :

    This is my .pro file :

    # Project created by QtCreator 2013-01-20T15:42:31
    #
    #-------------------------------------------------

    QT += core

    QT -= gui

    TARGET = tutorial1
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app


    SOURCES += main.cpp



    and this is the main.cpp :

    #include <QCoreApplication>
    #include <iostream>
    using namespace std;


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

    cout << "Hello World" << endl;

    return a.exec();
    }


    This prints Hello World when executed from a linux terminal but no output within the terminal window opened by QT after compiling...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Terminal output works but not within QT - Why ?

    Qt doesn't open any console windows.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 8
    Last Post: 23rd April 2016, 06:04
  2. Replies: 1
    Last Post: 20th July 2012, 11:46
  3. Output to terminal
    By wookie1 in forum Newbie
    Replies: 5
    Last Post: 12th June 2012, 14:22
  4. not able to read output from the terminal
    By jack101 in forum Qt Programming
    Replies: 3
    Last Post: 26th March 2012, 17:53
  5. Replies: 3
    Last Post: 6th July 2011, 06:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.