fyodor
3rd December 2011, 22:05
Hello. I am trying to do simple hello world console app with Qt. I use Qt 4.7.4 libraries and QtCreator 2.3.1 on Windows 7 x64 Home Premium SP1. When I build and run it nothing happens. Just a blank console appears. Here is code:
#include <QtCore/QCoreApplication>
#include <QString>
#include <QTextStream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString str = "Hello World";
QTextStream out(stdout, QIODevice::WriteOnly);
out << str;
return a.exec();
} and .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2011-12-03T21:44:19
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = untitled
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp I tried on OSX Lion 10.7.2 but the result is same. So is it a bug or am I doing something wrong?
#include <QtCore/QCoreApplication>
#include <QString>
#include <QTextStream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString str = "Hello World";
QTextStream out(stdout, QIODevice::WriteOnly);
out << str;
return a.exec();
} and .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2011-12-03T21:44:19
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = untitled
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp I tried on OSX Lion 10.7.2 but the result is same. So is it a bug or am I doing something wrong?