Тема: Hello World
Показать сообщение отдельно
Старый 12.06.2012, 22:23   #4
jimon
 
Сообщений: n/a
Ответ: Hello World

NetBuilding
вполне возможно что текст просто не вывелся в консольный буфер (он кешируется), из-за того что у тебя нету QApplication

попробуй так :
#include <QtCore/QCoreApplication>
#include <QTimer>
#include <QTextStream>
#include <QDebug>
#include <iostream>

//by Wim Peeters: a console application
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv); //renamed the a to app
    QTextStream qout(stdout); //I connect the stout to my qout textstream

    qout <<     "1. Starting the application\n";
    std::cout << "2. Some normal iostream output before using qDebug\n";
    qDebug() << "3. Some output with qDebug after the iostream output\n";

    QTimer::singleShot(5000, &app, SLOT(quit())); //stop after 5 seconds

    return app.exec(); //and we run the application
}
 
Ответить с цитированием