[Qt-creator] Console problem and others
Varga Virag
gwirag at gmail.com
Tue Nov 11 20:47:59 CET 2008
Thank you for the quick response.
I would like to code a non-gui application, so I chose console project. It's originally a program using sql, but I've tried to uncomment these lines, but no effect.
So the code is actually:
#include <QtCore/QCoreApplication>
#include <QDebug>
#include <iostream>
int main(int argc, char *argv[])
{ QCoreApplication a(argc, argv); // QSqlDatabase db =
QSqlDatabase::addDatabase("QMYSQL"); // db.setHostName("localhost"); //
db.setDatabaseName("something"); // db.setUserName("suser"); //
db.setPassword("spass"); // bool ok = db.open(); // // if(ok == false)
// { // qDebug()<<"Some error happened.."; // return -1; // }
qDebug()<<"It is oke."; std::cerr<<"It is oke.";
return a.exec(); }
In the .pro file I found a line: CONFIG += console. It's just the same, I compile the sources with or without this option.
(But as I remember it is important just on windows.. )
So, the platform: Ubuntu 8.04, Linux 2.6.24-19, Gnome 2.22.3, QMake version 2.01a, Using Qt version 4.3.4
And one thing: the output works well, when I start the compiled program from a terminal.
Thank you,
Virag
More information about the Qt-creator-old
mailing list