Monday, January 3, 2011

Print to console in Qt

To print to console in Qt
  1. write the code the usual console output way, e.g. "std::cout << ...", Note that any QString object must be quoted inside "qPrintable" function, e.g. "std::cout << qPrintable(QString("hello")) << .."
  2. enter "qmake -project"
  3. add "CONFIG += console" to the xxx.pro file
  4. enter "qmake"
  5. enter "make"

No comments:

Post a Comment