PDA

View Full Version : Activating Console in VS2008 Qt Integration Gui App



sepp
4th December 2010, 19:28
Hi,

i have a Win32 Qt Gui App build with VS2008 and the Qt VS Integration. Now i face crashes in Release mode, while Debug mode runs fine. Therefore i'd like to have messages in the console in release mode, but std::cout seems to be indirected into nowhere... I assume i have to state

CONFIG += console

somewhere, but where? I'm building inside VS2008...

Thanks for any help,

Sebastian

johnc
4th December 2010, 22:20
Try including the following header:

#include <QtDebug>

And then you can place debug statements like the following:

qDebug() << "Some out string";

Which uses the std::cout stream insertion format. The output will show up in the Visual Studio output window - no need for console.

sepp
5th December 2010, 10:21
qDebug() << "Some out string";
...
The output will show up in the Visual Studio output window - no need for console.

Thanks. But i need debug messages in release mode, when my App is running outside VS2008 (and therefore, there is no VS outout window)...

tbscope
5th December 2010, 10:36
The config += console needs to go in your .pro file

sepp
5th December 2010, 13:04
The config += console needs to go in your .pro file

Well, basically, i don't have a .pro file, because i used Qt Visual Studio Integration from the scratch...

I did the following test now which is like my approach:

- created a Qt Application in VS 2008 by the Qt Visual Studio integration
- created a basic .pro file from within VS 2008
- added CONFIG+= console
- closed my VS2008 .sln file and opened the .pro file in VS 2008

Well, besides that rcc fires an error now, i have the /SUBSYSTEM:CONSOLE in my linker switches now, but this is not what i want, because it makes my App to a console application.

Hmm. Seems to be difficult. From gtkmm i know that it is possible to have a Win32 Gui application with console i/o....

tbscope
5th December 2010, 13:15
Then I don't think this has anything to do with Qt.
See the Visual Studio documentation on how to open a debugging console.

sepp
5th December 2010, 14:51
Then I don't think this has anything to do with Qt.

You're right. The link below solved the problem for me, in case anybody else here needs the same (Win Gui App with console):

http://www.halcyon.com/~ast/dload/guicon.htm

Thanks Sebastian