PDA

View Full Version : Output to terminal



wookie1
11th June 2012, 17:16
Hi I'm brand new to Qt, hence the forum, and having troubles running a tester hello world program.
I used create project - console project.


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

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << "Hello World";

return a.exec();
}


This builds ok and runs with no errors but the terminal doesn't output any text.
When I tried not outputting to console it outputted into the application output window fine.
I'm not sure what to check next, any help is much appreciated.
I'm on UBUNTU 12.04

wysota
11th June 2012, 21:48
How do you run this application?

wookie1
12th June 2012, 00:17
I just click on the little green run button. The Ctrl R shortcut one.

wysota
12th June 2012, 01:29
In other words you launch it from Qt Creator. And the "Application Output" (or whatever it's called in English) pane remains empty? What happens if you run the app from within a terminal?

ChrisW67
12th June 2012, 01:45
Yes, it is called "Application Output"

If the Qt Creator Run Settings for the project are "Run in terminal" and the terminal program cannot be launched then you get no output. The terminal command can be found Under the Tools menu, Options..., Environment page, General tab. On my machine it is "xterm -e" but I think Ubuntu puts something non-functional in there (there's a recent similar post).

You could also turn off the Run In Terminal option if your program does not require user keyboard input: all output will then go into the "Application Output" pane.

wookie1
12th June 2012, 14:22
That's solved it, thanks.